tags:

views:

310

answers:

1

hi

how to assign a cell value from grid view control to string variable(local variable)

thanks

+1  A: 

On the GridView row bound event, It would be something like for the first column of that row:

v = e.Row.Cells(0).Text

Specifically, if val is your global string, then:

Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound
    If (e.Row.RowType = DataControlRowType.DataRow) Then
        val = e.Row.Cells(0).Text
    End If
End Sub
BenB