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:dateTi me" minOccurs="0" />
<xs:element name="sendernam e" type="xs:string " minOccurs="0" />
<xs:element name="senderema il" type="xs:string " minOccurs="0" />
<xs:element name="subject" type="xs:string " minOccurs="0" />
<xs:element name="forwarded " type="xs:boolea n" minOccurs="0" />
<xs:element name="replayed" type="xs:boolea n" minOccurs="0" />
<xs:element name="hasattach ment" type="xs:boolea n" minOccurs="0" />
<xs:element name="importanc e" type="xs:boolea n" minOccurs="0" />
<xs:element name="seen" type="xs:boolea n" 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.MessagesCou nt;
if(msgcont <= 0)
{
//Display some messages
return;
}
// Set the View
divInbox.Visibl e = 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=\"M M_swapImage('Ne xt','','MailToo ls/Images/B_Next_O.jpg',1 )\"
onmouseout=MM_s wapImgRestore() ><img ID='Next'
src='mailtools/Images/B_Next.jpg' align='center' border=0
<a>",Page.GetP ostBackClientHy perlink(lbtnAct ion ,"next,"+(PageN umber + 1)));
String PreviousLink = String.Format(" <a href={0}
onmouseover=\"M M_swapImage('Pr evious','','Mai lTools/Images/B_Previous_O.jp g',1)\"
onmouseout=MM_s wapImgRestore() ><img ID='Previous'
src='mailtools/Images/B_Previous.jpg' align='center'
border=0><a>",P age.GetPostBack ClientHyperlink (lbtnAction, "Previous," +
(PageNumber - 1)));
if(IStart <= 1)
{
//no next
IStart = 1;
NextLink = "";
}
if(IEnd >= msgcont)
{
//no prives
PreviousLink = "";
}
// Bin the Data
DataTable dtMessages = oMH.GetAllMessa ges(IStart,IEnd ) ;
DataView gridsort = dtMessages.Defa ultView;
gridsort.Sort = SortString;
dgInbox.DataSou rce = gridsort;
dgInbox.DataBin d();
}
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