getting value of a textbox from a datagrid
-
Hi! I am having problem getting a textbox value once the user clicks a 'add button' below are my codes Protected Sub dgProdList_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles dgProdList.ItemCommand If e.CommandName = "Add" Then Dim tbox As TextBox = CType(e.Item.FindControl("txtQty"), TextBox) in above tbox is empty and I dont know why its empty please help
-
Hi! I am having problem getting a textbox value once the user clicks a 'add button' below are my codes Protected Sub dgProdList_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles dgProdList.ItemCommand If e.CommandName = "Add" Then Dim tbox As TextBox = CType(e.Item.FindControl("txtQty"), TextBox) in above tbox is empty and I dont know why its empty please help
Well i'm gonna assume here.... i think this is because you may have forgot about the headers in your gridview/datagrid etc.. so you need to do this...
If e.Item.ItemType <> ListItemType.Header Then
Dim tbox As TextBox = CType(e.Item.FindControl("txtQty"), TextBox)
End if
Hope this helps! Andy
-
Well i'm gonna assume here.... i think this is because you may have forgot about the headers in your gridview/datagrid etc.. so you need to do this...
If e.Item.ItemType <> ListItemType.Header Then
Dim tbox As TextBox = CType(e.Item.FindControl("txtQty"), TextBox)
End if
Hope this helps! Andy