call master page user control in normal aspx page..

Posted by Gopal_nivas under ASP.NET on 1/3/2011 | Points: 10 | Views : 3776 | Status : [Member] | Replies : 1

i have a user control(ascx) and i was called that user control into a master page..

and i inherited tat master page to normal aspx page..

for some condition in my aspx page the user control of the master page not to display.. and some condition it has to display..

how to hide/visible the user control of the master page..

need ur suggestions with example..



Posted by: SheoNarayan on: 1/3/2011 [Administrator] HonoraryPlatinum | Points: 25

Hi Gopal,

Use below code snippet, it will do the work. You will need to write following in the Page_Load of your .aspx page.
Control c = (Control)this.Master.FindControl("uc11");

c.Visible = false;

Here, "uc11" is the id of the user control in Master page.

Let me know if its working for you.

Sheo Narayan

Gopal_nivas, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response