Need GridView Help - VB

J

John G

I have a GridView that I've placed a template field into with a single button
that I want to be able to click that will update just the row the button is
located. This is all while in regular view mode (not edit mode).

I found a piece of VB code that sort of works but it goes through a loop and
updates the same field in every row.

Can anyone help me make this code only affect the current row?

Protected Sub btnReturn_Click(ByVal sender As Object, ByVal e As
System.EventArgs)

Dim row As GridViewRow
For Each row In gvRAMI.Rows
Dim test As CheckBox = CType(row.FindControl("CheckBox1"),
CheckBox)
If test.Checked = True Then
test.Checked = False
gvRAMI.UpdateRow(row.RowIndex, False)
End If
Next

End Sub

TIA
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top