views:

47

answers:

1

I have an user control in master page with id 'ucTopUser' and a button 'btnSub'.I need to hide the both control from my current aspx page.How can I do this?

A: 

To get the Masterpage from your aspx page you can use this.Master, and to hide the elements you can set their Visible property to false.

http://msdn.microsoft.com/en-us/library/system.web.ui.page.master.aspx
http://msdn.microsoft.com/en-us/library/486wc64h.aspx
http://msdn.microsoft.com/en-us/library/system.web.ui.control.visible.aspx

((UserControl)this.Master.FindControl("ucTopUser")).Visible = false;
((Button)this.Master.FindControl("btnSub")).Visible = false;
Dan Dumitru