473,387 Members | 1,683 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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 1235

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Alex | last post by:
I created a page to show RealEstate Data with images retrived from the MSSQL 2000. I am using a DataGrid control: <asp:datagrid AllowPaging="True" OnPageIndexChanged="Pageindexchanged" > ...
0
by: Stephen | last post by:
This is a real brain-teaser and i'd really appreciate it if someone can try and understand what im trying to do and give me a few pointers or ideas to help me work out my problem. Im basically...
3
by: Joseph D. DeJohn | last post by:
I am trying to get pagination working on a datagrid. Can anyone point me to a resource for help on this? I'm not sure if custom paging is the best option or not.
6
by: Shawn | last post by:
Hi. I already have a datagrid where I'm using paging. I have a stored procedure that fills a temp table with 200-500 rows and then sends back 10 records at the time. When I go to page 2 the SP...
2
by: ager | last post by:
Greetings, I have a problem that I am trying to work through. Any help would be appreciated. I have an asp.net application that uses framesets. It has a banner frame, contents frame, and a...
5
by: tshad | last post by:
Is there a way to carry data that I have already read from the datagrid from page to page? I am looking at my Datagrid that I page through and when the user says get the next page, I have to go...
2
by: saleek | last post by:
Hi, I am trying to figure out why my datagrid has stopped firing the page and sort commands. Scenario: I originally had template columns in my datagrid and had set up custom bi-directional...
6
by: coleenholley | last post by:
Hi All :-) I need to populate a table I created as a web form. Are there any links to show me how to do this? I CANNOT use a dtagrid for this, the table has to be laid out as follows: Header...
3
by: Fao, Sean | last post by:
I have a DataGrid that I'm adding CheckBox controls to at runtime (in the code behind) and I'm not sure if I'm doing it correctly. First of all, I noticed that the MyDataGrid.Columns.Add() method...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.