The rowupdating event
But as I noted in the comments in that method, some collections that should contain the columns (names, old values and new values) are always empty. And the Row Updated method is never even touched!!! NET Forums that I need to use a Data Source control.For example a Sql Data Source, which is automatically added to your Web Form if you drag-n-drop your way around Visual Studio 2005.
That means if there are 100 rows to be updated the Sql Data Adapter will execute 100 separate operations against the database.One approach to solving this problem is to clone the command object so you have a different actual reference: This will work, but since the Command Builder is still connected to the Data Adapter, the Row Updating event will still fire and performance will be hit.The visitors to a web site can typically be divided into two groups: the users and the administrators.But for this demo, I’ll show you the simple version, that also doesn’t work 🙂Let’s bind the data to our Grid View and have it autogenerate our columns, as well as an edit button.When we edit a row in our Grid View and press the “Update” button, at some time it’s received in the Row Updating method.There are also two events associated with this that you can use � Row Updating and Row Updated. in the absence of batch update, both of these events are raised for each and every row being updated.
For example, if we are updating 100 rows, both of these rows are raised for 100 times.
Check out what I’m trying to do, maybe you can help?
First, I load up some data: After that, I’m doing some work to make my Grid View look beautifull, adding all columns by hand.
When I hit Update, the changes are not saved, and there is no error message. When I hit Update, the changes are not saved, and there is no error message. Then the page posts back, the text boxes go back to being labels and the new values are lost, and the Row Updating code never fires. Yes, I did put the breakpoint at the Row Updating line (and not in the function).
I put a breakpoint on the Row Updating event handler and found that the event is not fired. I put a breakpoint on the Row Updating event handler and found that the event is not fired. In the Row Editing function, the edit textboxes appear and I can get the "old" values Then the page renders, I edit the textboxes and hit Update.
Following code illustrates use of this feature: Notice how we have attached event handlers to the Row Updating and Row Updated events.