Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Display the last page initially in DataGrid, how?
Message
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
C# 1.1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01009344
Message ID:
01010238
Views:
25
>Dawa,
>I guess I am not really answering your question, but would reversing the order in your select statement work for your customer? Lets say you order the records by some date field, what about switching the order from acending to decending order.

Our client wants it this way. They want the date to be ascending but to show the last page initially. They said the decending order would confuse their users.

>Why do you specify the datasource twice in your code example? And why do you bind it twice?

Because I don't get a pagecount before I before the initial binding. The second binding is an atempt to display the last page which does display the last but when the "Previous" link button stops working at some point before it reaches the first page. Somebody showed me a way to fire the PageIndexChanged event after initail binding.

So now the following works:
this.myDataGrid.DataSource = this.myDataSet.Tables[0].DefaultView;
this.myDataGrid.DataBind();
if (!Page.IsPostBack) 
{
	// Create an event args... 
	System.Web.UI.WebControls.DataGridPageChangedEventArgs dgEA = 
		new System.Web.UI.WebControls.DataGridPageChangedEventArgs(
		this.myDataGrid,this.myDataGrid.PageCount-1); 

	// Invoke the PageIndexChanged() event... 
	this.myDataGrid_PageIndexChanged(this.myDataGrid, dgEA); 
}
Dawa Tsering


"Do not let any unwholesome talk come out of your mouths,
but only what is helpful for building others up according to their needs,
that it may benefit those who listen."

- Ephesians 4:29-30 NIV

Dare to Question -- Care to Answer

Time is like water in a sponge, as long as you are willing you can always squeeze some.

--Lu Xun, Father of Modern Chinese Literature

Previous
Reply
Map
View

Click here to load this message in the networking platform