Updating with gridview

Posted by / 01-Jul-2018 18:04

The field that's being updated from the Radio Button List is the third field in the row, so the code updates the row in position zero and the column in position two (as shown in Listing 1).

About the Author Peter Vogel is a system architect and principal in PH&V Information Services.

In this case, we replaced the default Label with a Radio Button List that had its Data Source set to a table that listed the user's choices.

When the user finished making their changes, they clicked an "Update Survey" button on the page.

In this example, I'm searching the Data Set using the table's primary key -- a column called "Id" -- that's displayed in the first column in the Grid View.

While I'll only ever find one matching record, the Data Set's Select method returns an array of Data Rows, so I have to access the first row in the result (drs[0]).

updating with gridview-74updating with gridview-50updating with gridview-26

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.

One thought on “updating with gridview”