Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Aug 2004
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question ASP.NET2.0/SQL2005: Split Long String with Paging

    Does anyone know (or can point me to an example of) how to split a long string retrieved from a db (8000+ characters) and utilize the paging feature of one of the .NET 2.0 xview controls (gridView, detailsView etc.)? I am creating a light weight CMS for my site and when presenting an article to the presentation layer I would like to page through long articles instead of having a single long page.

    Thanks in advance.

  • #2
    Senior Coder nikkiH's Avatar
    Join Date
    Jun 2005
    Location
    Near Chicago, IL, USA
    Posts
    1,973
    Thanks
    1
    Thanked 32 Times in 31 Posts
    You're trying to do this with straight SQL and a datasource, or do you have a business object (or DAL) layer?
    SQL Server?

    If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
    Bored? Visit
    http://www.kaelisspace.com/

  • #3
    New Coder
    Join Date
    Aug 2004
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by nikkiH View Post
    You're trying to do this with straight SQL and a datasource, or do you have a business object (or DAL) layer?
    SQL Server?
    BLL and DLL

  • #4
    Senior Coder nikkiH's Avatar
    Join Date
    Jun 2005
    Location
    Near Chicago, IL, USA
    Posts
    1,973
    Thanks
    1
    Thanked 32 Times in 31 Posts
    There is no easy (read: out of the box) way to do this -- you have to code it.

    The paging feature of a grid is meant to page through "rows". Anything enumerable, really, whatever the grid is bound to. It gets so many of those items per page. You'd need to override this behavior and basically catch the page event and code the new behavior if you wanted paging to be over something that is one item in one row instead.

    Your other option is to give it an enumerable object collection instead of one field of text. Split it yourself and hand off your new object as what gets databound. I'd think this would be easier, actually, but I dunno.

    It depends on how much control you have over your BLL/DAL and what your architecture goals are, how many tiers, and so on.

    If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
    Bored? Visit
    http://www.kaelisspace.com/


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •