Solved

How to hide a control in a master page?

Posted on 2010-09-04
7
472 Views
Last Modified: 2012-08-13
HI

I have a master page which has a menu and a control (DropDownList) that must be hidden according to the section in which the user navigates.

How to do that ?

Thanks in advance.
0
Comment
Question by:dimensionav
  • 4
  • 2
7 Comments
 
LVL 12

Expert Comment

by:Mohamed Abowarda
ID: 33603888
Use display: none; in CSS to hide any element in HTML document.
0
 

Author Comment

by:dimensionav
ID: 33603897
but in ASP how could I know in which page is the user navigating, in order to decide when to hide the control?
0
 
LVL 12

Expert Comment

by:Mohamed Abowarda
ID: 33603916
Are you using AJAX?
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:dimensionav
ID: 33603924
not Jet, but if you show me how I wouldn´t mind to use it
0
 
LVL 1

Accepted Solution

by:
teleportator earned 500 total points
ID: 33609027
Hello!
On the page you want to hide your user control you can do the following:
Control myControl = his.Master.FindControl("ControlIDYouWantToHide");

myControl.Visible = false;

Open in new window

0
 

Author Comment

by:dimensionav
ID: 33620385
I have to perform some changes to your code, first of all I have changed it to VB and added it inside of INIT event, just like this:


Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim mddlCategory As DropDownList = Me.Master.FindControl("ddlCategory")
        mddlCategoria.Visible = False
    End Sub

Open in new window

0
 

Author Closing Comment

by:dimensionav
ID: 33620408
Te code was a little different (C#) but with some adjustments it worked very well.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now