October 22nd, 2013, 12:58 AM
label under template field is not coming under events of visual basic event drop-down
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.
October 23rd, 2013, 01:24 AM
Re: label under template field is not coming under events of visual basic event drop-
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..
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"
Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
WPF Articles : 3D Animation 1 , 2 , 3
Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.
Tags for this Thread
Click Here to Expand Forum to Full Width