caibeier
asked on
Find Controls in <EditItemTemplate> in GridView web control, ASP.NET 2.0
Hi experts,
I'm have GridView control in my ASP.NET page. Within <EditItemTemplate> in one of the GridView's columns, there is a Textbox. I'm just wondering, is it possible / how to get a reference of the textbox control so I can do something with it (i.e. When user enter editing mode, set the width of the textbox base on the length of text string)
I tried the following, but it gives me NullReference exception
Private Sub GridView1_RowEditing(ByVal sender As Object, ByVal e As System.Web.UI.WebControls. GridViewEd itEventArg s) Handles GridView1.RowEditing
Dim mytxt As TextBox = Me.GridView1.Rows(e.NewEdi tIndex).Fi ndControl( "txtLastNa me")
mytxt.Columns = GridView1.Rows(e.NewEditIn dex).Cells (3).Contro ls.Item(1) ' This is the text supposed to be in the textbox
End Sub
I'm have GridView control in my ASP.NET page. Within <EditItemTemplate> in one of the GridView's columns, there is a Textbox. I'm just wondering, is it possible / how to get a reference of the textbox control so I can do something with it (i.e. When user enter editing mode, set the width of the textbox base on the length of text string)
I tried the following, but it gives me NullReference exception
Private Sub GridView1_RowEditing(ByVal
Dim mytxt As TextBox = Me.GridView1.Rows(e.NewEdi
mytxt.Columns = GridView1.Rows(e.NewEditIn
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER