Since the Drop Down List is in the Item Template of the Grid View control so I placed the Required Field Validator inside the Item Template right beneath the Drop Down List control.It is a common scenario that you want the first item of the Drop Down List to be some message saying "Please select an item".A Grid View Update Event Args object is passed to the event-handling method, which enables you to determine the index of the current row and to indicate that the update operation should be canceled.
You can use both "Bound Fields" & "Template Fields" now.
Dear All, In Row Updating event of a Grid View I am trying to update the database picking the values of bound text Boxes in the Edit Item Templates. I confirmed update works by giving some other text vlaues instead of those retrieved from TB1, TB2, and TB3. I checked your code, it is working very good; below example of the code I used here...
To manually specify columns for the gridview you have to set Auto Generate Columns="false".
Now you can specify the columns that you want in your Grid View.
Update: the problem looks like that you have also bind your Edit Item template columns with the data from data table, and when you are getting the data in the code behind you are not getting the updated data which the user updates in edit mode and u still getting the old data.
You can find the textbox that is generated on edit event in the Row Updating event below and assign it to a string variable.
But Values retrieved from the tex Boxes are old values (not the newly typed in values in Edit mode) So in effect no updating is happening.
Tell me where I have gone wrong and Please suggest some ways to fix this problem. Here, when click Edit button on "C" row, and modified values from f1C to f1CXX; and in the rowupdating method, it is getting f1CXX only... I am getting some problems in the code you posted aslo.
Then have a seperate function to update the values entered and finally call your Bind Grid() function which again binds the gridview..
Note: I'm using stored procedure to update my DB table.
event is raised when a row's Update button is clicked, but before the Grid View control updates the row.