473,725 Members | 2,017 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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: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
Nov 19 '05 #1
0 1251

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

Similar topics

1
4441
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" > Sub PageIndexChanged(ByVal sende.........)
0
1627
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 using the example of CUSTOM PAGING on a DataGrid on this page: http://www.dotnetjunkies.com/Tutorial/EA868776-D71E-448A-BC23-B64B871F967F.dcik and im trying to add extra functionality in the DataGrid Paging - Custom Paging example. I'm able to get...
3
8688
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
1813
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 fills the temp table again and returns rows 10-19. The temp table is dropped after each call to the SP, so it has to be created and filled every time the user changes page in the datagrid. My question is this: Would it be more efficient to...
2
1141
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 main frame. I have a datagrid that is displayed in the mainframe. I would like to use custom paging with it. (I have found some very good tutorials on custom paging.)
5
2790
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 to the database to get the next page. Is there a way to use the dataset to allow us to read back and forth in it instead of going back to the database to get it? Thanks,
2
3150
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 sorting as well as paging of the datagrid records.
6
1531
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 Row Header Row Static data Dynamic (read only) data <Break> Header Row Header Row Header Row Header Row
3
3150
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 expects a DataGridColumn so I instantiated an object of type TemplateColumn that I had hoped I could add a CheckBox to. I soon discovered that the ItemTemplate property of the TemplateColumn class returned an object that had implemented the...
0
8752
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9401
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9257
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9174
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9111
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8096
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6011
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4782
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2634
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.