Gridview1rowupdating findcontrol

03 Mar

In this example, this time I used my own database called Sample DB which has Customers Table and basically contains the following field columns: As you have noticed in STEP 2, we have added six Text Box and a Button in the web form in order for us to type the information there and Insert them to the database.

Now let’s create a method for executing the Update or Insert.

You need to include the Grid View Command Field column to add Edit, Update and Cancel Buttons in the Grid View. You need to include Template Field for every column you want to provide Editing because Template Field provides you both Item Template and Edit Item Template to create interface for two separate Grid View modes. You need to handle Grid View events such as Row Editing, Row Canceling Edit and Row Updating to provide desired editing functionality.

This demo is a continuation of my previous example “Binding Grid View with Data”. When I do an update, and get to the Grid View1_Row Updating, there is no value passed to "ID", and then when I go to the next row for "Company" I get the following error: Specified argument was out of the range of valid values. Text; bit when ichange it to string id =((Text Box) Grid View1. Line 136: Source Error: Line 134: string Um = ((Text Box)Grid View1.

If you are not familiar of binding the Grid View the way then I would suggest looking at my previous example first before you proceed to this example. Parameter name: index Any idea what I need to do to fix this issue?

In this demo, I presumed that you already have a basic background on how to create a simple database table. Thanks that cmd do not work fine string id = Grid View1.

If you want to update the grid based a selection from a drop down list in the grid.

You would either 1 update it during the on selected index change of the drop down list or the update command of the grid.