American express sex chat rooms - Gridview rowupdating event does not fire
First, we’ll implement a method to databind the Grid View, which will be called whenever databinding needs to be performed.
We’re using Linq to SQL to pull data from our database and bind it to the Grid View.
The Grid View 'Grid View1' fired event Row Deleting which wasn't handled. When I say manually databinding I mean not using a data source control specified as a Data Source ID, but rather setting the Grid View’s Data Source equal to the appropriate data object and calling Data Bind. NET 2.0 are familiar with how to deal with this, but since ASP.
NET 2.0 most of the examples and tutorials deal with setting the Data Source ID, which buys you a lot of automation that you may not even appreciate unless you’ve done this the old fashioned way.
To avoid this we need to keep the property Read Only as false, Then in the edit mode nothing will happenes. The reason I use Template Field instead of Bound Field is that, it is very easy to grab those controls in the codebehind if we user labels or textboxes.
In case of the bound field’s we need to check what column it is and need to use index of that cloumn, which is little hard and even in future if we change the column order If you see the Last Template Field part in the above code, I am using the link buttons for edit, update, delete and cancel.
The above piece of code will also do the same as label in Item Template and Textbox in the Edit Item Template.
By default all the boundfields will be trasferred as Textboxes in Edit Mode.
If we use proper command names for the buttons like “EDIT”, “DELETE”, “UPDATE”, “CANCEL” these will also trigger the appropriate Grid View Events.
Ok let’s move on to Code behind what we have to do when user clicks Edit, Delete, Update and Cancel When we click on Edit the On Row Editing event will be fired.
The way we’ll accomplish this is to create two properties that store those values in View State.