Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

User Control Change depending on location 1

Status
Not open for further replies.

suicidaltendencies

Programmer
Jan 28, 2004
58
US
I have an user control that needs to be used in a public area and an administrative area. I'd like to use the same control but hide a datagrid if it is displayed in the public area and have the datagrid visible if it is in the admin. area. Can anyone help?

Thanks,
Harold
 
You should access from the container page to your user control and its controls as well:
Code:
Control myControl = Page.FindControl("myControlId");
DataGrid dg = myControl.FindControl("gridId");
if(!userIsAdmin)
{
  dg.Visible = false;
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top