chriscboy
asked on
How do I reference controls in in TabPage in C#
How do I reference controls that are in a TabPage of a TabControl?
I have a TabControl called tabMain, and have created three TabPages called tabHazard,tabRisk,tabActio n. Inside tabHazard I have a datagrid called dgridHazard. How would I reference this datagrid in code?
I thought it might be something like tabMain.tabHazard.dgridHaz ard but I'm not getting any joy.
I have a TabControl called tabMain, and have created three TabPages called tabHazard,tabRisk,tabActio
I thought it might be something like tabMain.tabHazard.dgridHaz
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Try this
DataGrid dgid = tabMain.Controls[0].FindControl("dgridHazard") as DataGrid;
if it does not work then
DataGrid dgid = tabMain.Items[0].FindControl("dgridHazard") as DataGrid;
ASKER