Gridview rowupdating example asp net
The Grid View Edit Event Args class has a property called New Edit Index that tells us the row number being edited.We need to set the Edit Index property of the Grid View to this new edit index.Once you set these properties you will find that the column headers of all the columns for which you specified Sort Expression property appear as clickable link buttons.Clicking on the link buttons raise two events: Just like paging events these events follow pre and post pattern.The Sorting event allows you to cancel the operation also.The Sorting event handler receives an event argument of type Grid View Sort Event Args.
Here, we first retrieve the new values entered in the textboxes.
Here, we store the value of Sort Expression property into a Veiw State variable called sortexpression. Finally, we call Bind Grid() method which will bind sorted version of the Data View with the grid.
We need to access this variable from Bind Grid() method so that our sorting will work correctly under all the circumstances. The following figure shows the Grid View after implementing sorting.
The Grid View Sort Event Args class has three important properties.
The Sort Expression property supplies the sort expression that you specified earlier for the column being sorted.