Onrowupdating vb gridview Teacher xxxchat online free

Although the Grid View Command Event Args have a Data Item member that member is unfortunately not set with the Data Row as you would maybe expect.

onrowupdating vb gridview-1

At that point I have the data I need to be on my way and do my business logic (which in this case is very simple).One advantage using this approach is that I do have access to the underlying data source item (a Data Row here) and so I can update the value and rebind easily and immediately show the updated value(s).So I'm taking a few minutes - for my own sake - to write this stuff down so I can look it up next time I have a brain fart Using a Button Field you can specify a Command Name which in turn provides the On Row Command event some context as to what type of operation you are dealing with in Code Behind.In Code Behind you have to do a bit of work though if you want to retrieve the proper context from a Data Item.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.If you need custom text for the caption you can't do that because databinding expressions are not allowed.The following does not work: because it's not a template container.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.In the case of the Command Argument passed on a standard control it's the actual command argument and so you have to very carefully make sure you separate each of those operations.