skip to content »

Rowupdating gridview

We need to convert these Bound Fields to Template Fields.In order to do so select "Edit Columns..." from the smart tag of the Grid View. Select Company Name and Contact Name fields and click on "Covert this field into a Template Field" link.

I used your code in Row Editing event and gridview becomes editable, but I still have some trouble in accessing the Edit Template controls... Find Control, I only get unedited values, those initially displayed from database, not the actual values displayed on screen. Rows(index) Dim str Add As String = "" str Add = (CType(row. The problem is: when I retrieve data using Grid View. Grid View Command Event Args) Handles gv Autorizzazioni. Command Name = "Crea Autorizz") Then Dim str Per Insert As String = "" Dim index As Integer = Convert. Command Argument) Dim row As Grid View Row = gv Autorizzazioni. Protected Sub gv Autorizzazioni_Row Command(By Val sender As Object, By Val e As System. Protected Sub gv Autorizzazioni_Row Command(By Val sender As Object, By Val e As System. So I have my Gridview with Data Source set to a Data Table on page Load event : In the Click event of the button I want to retrieve current values of the controls, as displayed on Web page after user's actions, and pass them to my sp as a comma-separated string. Is Null Or Empty(str Add) = False Then str Per Insert = str Per Insert & str Add & "," ' on to add values to string What to do to retrieve edited values? I also tried setting Edit Index to the index of "pseudo-edited" row, just before your code: Thanks, yousuf... I think Edit Index is nothing, because the whole Edit thing is never raised. We will use the Custom Validator control for this purpose.

Just like we attached the Required Field Validator control to the Text Box, attach a Custom Validator to the Contact Name column. If you run the web form and try entering wrong value in the Contact Name column then you will see the error message displayed as before and the value will not be accepted by the Grid View control.

Make Company Name blank and click on Update button.

You should see an error message as shown in Figure 7.

This will display the template designer for the column as shown in Figure 6.

Next, drag and drop a Required Field Validation control below the Text Box.

This way you can attach client side validation controls to the Grid View columns.