A Grid View Sort Event Args object is passed to the event-handling method, which enables you to determine the sort expression for the column and to indicate that the selection operation should be canceled.
aspdotnet-suresh offers C#articles and tutorials,csharp dot net,articles and tutorials, VB.
In the template field I will Place a label or some controls, So that it’s very easy to access those controls in the code behind by using Find Control method. Item Template is the content to display for the items in the Template Field.
Here you will find that you have to handle every command manually for the child grid because you are continuously changing binding of child grid.
And one thing I have found that if you did not write handler of edit, delete, update, sort, page command it will give error because when you press Edit Command of Child Grid it will find for the Row Editing Handler of child grid even if you are doing your all the activity in Row Command event. Here one thing is important is that in Row Command event of Child Grid you will get the old values in the grid means viewstate of the grid.
Ok let’s move on to Code behind what we have to do when user clicks Edit, Delete, Update and Cancel When we click on Edit the On Row Editing event will be fired.
You can see the C# code below will give the row number whatever you are editing by New Edit Index property.
Secondly if you want to include a custom field (some button or link) in the same column it’s not possible.
If we use proper command names for the buttons like “EDIT”, “DELETE”, “UPDATE”, “CANCEL” these will also trigger the appropriate Grid View Events.
event is raised when the hyperlink to sort a column is clicked, but before the Grid View control handles the sort operation.