DataGrid Custom Paging Problem

Discussion in 'ASP .Net' started by =?Utf-8?B?UmFlZCBTYXdhbGhh?=, Feb 16, 2005.

  1. I have aspx page with user control , in the user control i have DataGrid with
    custom paging the grid is displaying contents of datatable as following
    schema
    [ schema fragment]
    <xs:element name="id" type="xs:string" minOccurs="0" />
    <xs:element name="size" type="xs:int" minOccurs="0" />
    <xs:element name="filesize" type="xs:long" minOccurs="0" />
    <xs:element name="date" type="xs:dateTime" minOccurs="0" />
    <xs:element name="sendername" type="xs:string" minOccurs="0" />
    <xs:element name="senderemail" type="xs:string" minOccurs="0" />
    <xs:element name="subject" type="xs:string" minOccurs="0" />
    <xs:element name="forwarded" type="xs:boolean" minOccurs="0" />
    <xs:element name="replayed" type="xs:boolean" minOccurs="0" />
    <xs:element name="hasattachment" type="xs:boolean" minOccurs="0" />
    <xs:element name="importance" type="xs:boolean" minOccurs="0" />
    <xs:element name="seen" type="xs:boolean" minOccurs="0" />
    <xs:element name="type" type="xs:string" minOccurs="0" />

    inside the function showInbox() that bind the datatable to datagrid

    void showInbox()
    {
    ....
    int msgcont = oMH.MessagesCount;

    if(msgcont <= 0)
    {
    //Display some messages
    return;
    }
    // Set the View
    divInbox.Visible = true;
    NoMsg.Visible = false;

    // Set the Paging of the Grid
    IStart = msgcont - (PageNumber * PageSize) + 1;
    IEnd = IStart+PageSize-1;
    // The Next and Previous Links
    String NextLink = String.Format("<a href={0}
    onmouseover=\"MM_swapImage('Next','','MailTools/Images/B_Next_O.jpg',1)\"
    onmouseout=MM_swapImgRestore()><img ID='Next'
    src='mailtools/Images/B_Next.jpg' align='center' border=0
    ><a>",Page.GetPostBackClientHyperlink(lbtnAction ,"next,"+(PageNumber + 1)));

    String PreviousLink = String.Format("<a href={0}
    onmouseover=\"MM_swapImage('Previous','','MailTools/Images/B_Previous_O.jpg',1)\"
    onmouseout=MM_swapImgRestore()><img ID='Previous'
    src='mailtools/Images/B_Previous.jpg' align='center'
    border=0><a>",Page.GetPostBackClientHyperlink(lbtnAction, "Previous," +
    (PageNumber - 1)));
    if(IStart <= 1)
    {
    //no next
    IStart = 1;
    NextLink = "";
    }
    if(IEnd >= msgcont)
    {
    //no prives
    PreviousLink = "";
    }

    // Bin the Data
    DataTable dtMessages = oMH.GetAllMessages(IStart,IEnd) ;

    DataView gridsort = dtMessages.DefaultView;
    gridsort.Sort = SortString;
    dgInbox.DataSource = gridsort;
    dgInbox.DataBind();
    }

    I set the page size = 20 , so the problem i have the item is not sorted
    properly ,that if i have 23 items in datagrid , first page has 20 items
    sorted well , but second page has items with new dates than the last items in
    first page ( mean in first page u can find sorted in desc dates from 2005 -
    down to 2003) click next page u will find date with 2005 ) . what u suggested
    to do in this case?

    Hope i explain the problem well
     
    =?Utf-8?B?UmFlZCBTYXdhbGhh?=, Feb 16, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?UGF0cmljay5PLklnZQ==?=

    DataSet paging vs Datareader paging

    =?Utf-8?B?UGF0cmljay5PLklnZQ==?=, Oct 8, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    10,879
    Scott Allen
    Oct 8, 2004
  2. wh1974
    Replies:
    0
    Views:
    2,492
    wh1974
    Jan 12, 2005
  3. Red
    Replies:
    1
    Views:
    771
  4. SStory

    Datagrid custom paging problem

    SStory, Sep 19, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    178
    SStory
    Sep 20, 2003
  5. Alex
    Replies:
    1
    Views:
    153
Loading...

Share This Page