Gridview rowupdating causesvalidation are calleigh and eric dating on csi miami
When it's all said and done neither of these approaches is particularly complex.However, if you've never gone down the path of using a Row Command event the discoverability of the above code is practically nil. Last month I was lamenting (to myself) that why are grids still so much work, when so much effort goes into improving other areas of a developer's life? Rick, Maybe I'm missing something, but I've got code that looks like this:protected void Handle Command(object sender, Grid View Command Event Args e)I agree that it would be much easier if the event args included the PK for the row directly, but that seems simpler than what you posted.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).
Donnie Donnie I think Row Index is not going to work in paged scenarios.
There is a Data Text Field that can be used to display a dynamic value (ie.
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.
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.
So rather than getting the bound item directly, I have to retrieve the grid Row's Data Item index, then use that index and retrieve the value from the original data source.
If you need custom text for the caption you can't do that because databinding expressions are not allowed.