Hashtable copied Values; protected void grid_Custom Button Callback(object sender, ASPx Grid View Custom Button Callback Event Args e) protected void grid_Init New Row(object sender, Dev Express.
Bind Data could be called in Page Index Changing, but to show that it the event is raised, we’ve handled that in Page Index Changed.
The important point is not which of these two events call Bind Data, but one of them must or the Grid View will not be updated. When bound using a Data Source ID, the Grid View internally tracks the current Sort Expression and Sort Direction, and those are available through properties with the same names.
First, we’ll implement a method to databind the Grid View, which will be called whenever databinding needs to be performed.
We’re using Linq to SQL to pull data from our database and bind it to the Grid View.
The way we’ll accomplish this is to create two properties that store those values in View State.
We’ll get to how these properties are populated shortly, but first we need to go back to the Bind Data method.
We can implement it in this way without a performance impact because the data is not actually retrieved from the database until required, so we can build up a chain of queries up to that point and only the end result will be pulled from the database. When manually databinding the Grid View, this will always show ascending, so we need to handle this manually with the following logic: After that we save the new Sort Expression.
We’re sorting on the appropriate field based on the Sort Expression, and setting the direction based on Sort Direction by calling either the Order By or Order By Descending methods. As with paging, we also reset the Edit Index and Selected Index when sorting.
ASPx Data Deleting Event Args e) 初始化回调事件 Callback protected void callback Panel_Callback(object sender, Dev Express.