468,290 Members | 1,849 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,290 developers. It's quick & easy.

DataGrid Custom Paging Problem

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','','MailTool s/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(lbtn Action, "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
Nov 19 '05 #1
0 1095

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Joseph D. DeJohn | last post: by
6 posts views Thread by Shawn | last post: by
2 posts views Thread by ager | last post: by
2 posts views Thread by saleek | last post: by
6 posts views Thread by coleenholley | last post: by
3 posts views Thread by Fao, Sean | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.