Datagrid problem
Hi
Can anyone help, on my web page I have a datagrid, I have added
<asp:TemplateColumn HeaderText="Qty">
<ItemTemplate>
<asp:TextBox id="TextBox1" runat="server" Text="" Columns="4" MaxLength="3" width="40px">
</asp:TextBox>
</ItemTemplate>
</asp:TemplateColumn>
to get an extra column, this works ok and you can enter in values
The code is
Private Sub MyList_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs ) Handles MyList.ItemCommand
Dim l As TextBox
Dim str As String
l = CType(e.Item.FindControl("TextBox1"), TextBox)
If Not (l Is Nothing) Then
str = l.Text
End If
End Sub
The FindControl works ok, but there is no text, the value of str, l.text are empty
doing
? e.Item.FindControl("TextBox1").id
will give
"TextBox1"
which i assume means that it has found the right control
doing
? e.Item.FindControl("TextBox1").Text
gives
'Text' is not a member of 'Control'.
there are no other controls on the form other than the datagrid
why should Textbox1 have no text member
any help greatly appreciated
Thanks
|