G
Guest
Hi,
I have a datagrid which contains some bound columns, some template
columns. The template columns contain text box in one column, Hyperlink
column in other column, dropdownlist in another column etc. Now I would like
to read the values in each of these columns. Inorder to read those I am doing
string text1 = CType(datagrid1.Items(0).cells(0).controls(0), TextBox).Text
string text2 = CType(datagrid1.Items(0).cells(1).controls(0), LinkButton).Text
In the above example I am hardcoding the control types like TextBox,
LinkButton etc. Instead of doing that I would like to get the type of control
first and then get the text from that control. I am not knowing how to get
the Control Type. If I do
datagrid1.Items(0).cells(0).controls(0).GetType.ToString() it is giving
TableCell for all the controls. Please let me know.
Thanks,
Sridhar.
I have a datagrid which contains some bound columns, some template
columns. The template columns contain text box in one column, Hyperlink
column in other column, dropdownlist in another column etc. Now I would like
to read the values in each of these columns. Inorder to read those I am doing
string text1 = CType(datagrid1.Items(0).cells(0).controls(0), TextBox).Text
string text2 = CType(datagrid1.Items(0).cells(1).controls(0), LinkButton).Text
In the above example I am hardcoding the control types like TextBox,
LinkButton etc. Instead of doing that I would like to get the type of control
first and then get the text from that control. I am not knowing how to get
the Control Type. If I do
datagrid1.Items(0).cells(0).controls(0).GetType.ToString() it is giving
TableCell for all the controls. Please let me know.
Thanks,
Sridhar.