Oddly I have no idea why the data item would not be available given that this particular grid is bound to a Data Table which has persistent backing and is live on the form.The problem with the button field is that it's very limited in functionality. Take a look at my example, it also shows how to get the Grid View row index and the primary key so that I can delete the record from my sql table.
Approved which would yield True or False only though) and a Data Format String that can in some cases make this work but for a more dynamic scenario as above that still doesn't do the trick.Template Columns and Commands If something more dynamic is required you need to use template fields.Personally I prefer using Template fields most of the time anyway because usually it gives you much more control.Here's some code that needs to retrieve a Pk of one of the bound items and then perform some work on the data (in this case the business object): This seems like a lot of code to have to write just to retrieve data context.The code first has to retrieve the Grid View Row, which is done by retrieving the Command Argument which in this case a row index of the rendered grid view items.From there I can then retrieve the Data Row based on the index.Again it seems odd given that we are firing a ROW level Row Command event that there's not an easier way to get row level context even when we are using a Command argument.Also notice that if you have both Button Fields/Command Fields and template items that have command arguments, the Command Argument will contain different things.In the case of a Command Field the Command Argument is the Row Index.I haven't used this in 6 months and had to lookup how to do it. See these articles for more details about Gridview Row Command Event View Class Row Hope this helps.For some reason the built-in Grid View "delete" feature does not work for me (have tried it on multiple setups). First your Grid View has a property called Data Key Names. You hav to set rowediting events in your inline code..