Objectdatasource updating event args

NET toolbox, and should be used when it proves to be the right tool for the job you have to do.

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.

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.

I don't know about you, but I cringe every time I need to create a Grid View based layout that needs to create a few custom link handlers off that grid.

The typical scenario might be a list where you can toggle certain options or where you can fire an operation that otherwise updates the data that's underlying the grid.I tend to use business objects in my applications so using the standard data controls doesn't work very well, nor would it really buy much in terms of abstraction.In my code I tend to write the databinding logic as part of the page logic which usually is just a couple of lines of code.This very class is executing all operations requested by AJAX scripts that constitute the other half of the framework.The implication of this is that the XML data controller descriptors are driving the behavior of business objects as well.First and foremost, data source controls are not the only way to bring data into an application.

Tags: , ,