one of my label that is created under template field of Gridview is not showing under event drop-down menu in code behind(VB). how can i solve this problem. please help.
Printable View
one of my label that is created under template field of Gridview is not showing under event drop-down menu in code behind(VB). how can i solve this problem. please help.
The label itself does not appear mostly because it's a child of the gridview, and as such you will have as many lables as there are rows in the data... hence you will not have a single referable label..
To reference the label when updating/loading the gridview use the RowDatabound event..Hope this helps..Code: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
Dim mylabel As Label = e.Row.FindControl("Labelid")
mylabel.Text = "Found this label"
End If
End Sub