For this sample to work, you must install the Sql Server 2008 R2 Express.
This sample contains a Sql Server database file, if you do not install Sql Server, The Data In page can also works fine.
A common way to use these collections is to HTML-encode the values supplied by the user before they are stored in the data source.
Save all or press "Ctrl S" and hit "F5" to run the page, the page will look as in the following image: Click on "Edit the Grid View", it will display Textboxes in each cell as in the following image: Edit the value(s) here and click on the Update link, it will update all the data or to remove it click on the "Delete" link above the image shown.
Find Control("lbl Contactidno")); String Contact ID=lbl. Text; Drop Down List ddl = ((Drop Down List)gv Contact Info. You should use A debugger can not only help you check if you are getting the correct value, it can also allow to walk through the steps.
Also, it is not a good idea to build sql query using string.
When I click edit on the grid and change the value of the textbox and click update the label will just display the original value of the textbox. "When I click edit on the grid and change the value of the textbox and click update the label will just display the original value of the textbox." So lets say there is "test" in the textbox originally and then I edit it to "asd" then click update.
After searching long and hard I found a great article that solved my issue. Text; Set a debugger and check if you are passing the correct (new) value to your sql query string, and use try-catch block to catch any exception when updating.EDIT You are reading the existing values of your control using the Find Control method in the Row_Updating event.These properties will automatically render Edit, Update and Cancel buttons inside Grid View column.I am using Template Field’s Item Template and Edit Item Template for providing read only and editing interface of the same column in the Grid View.
One note will be helpful for you, while describing Columns in Grid View if you are using a boundfield then create objects of the control using cells[index] in the rowupdateing event of Grid View, but if you are using controls itself like Label or textboxes etc then use Fincontrol("stringid").