Hello Everyone
I have been trying to get the value from selected row in Datagrid for ASP.NET, I have been looking everywhere for some code but without result, how can I do this
Thanks in Advance
Jon Sveinsson
Printable View
Hello Everyone
I have been trying to get the value from selected row in Datagrid for ASP.NET, I have been looking everywhere for some code but without result, how can I do this
Thanks in Advance
Jon Sveinsson
I haven't used the datagrid in this way yet but this will probably work:
TextBox txt = (TextBox)dg.Items[dg.SelectedIndex].Controls[myTextID];
string val = txt.Text;
(where dg is a reference to your datagrid)
if you're working with VB this should work
Dim GridValue as string = CType(e.Item.Cells(0).Controls(0), TextBox).Text
GridValue being the variable for the new value you're trying to get. e.Item.Cells(0) the number within those paranthesis corresponds to column you're trying to get to.
hope this helps
guyute