如何将网格视图控件中的单元格值分配给字符串变量(局部变量)
感谢
答案 0 :(得分:1)
在GridView行绑定事件上,它将类似于该行的第一列:
v = e.Row.Cells(0).Text
具体来说,如果val是你的全局字符串,那么:
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