We help IT Professionals succeed at work.

How to hide a control in a master page?

dimensionav
dimensionav asked
on
505 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.
Comment
Watch Question

Mohamed AbowardaSenior Software Engineer
CERTIFIED EXPERT

Commented:
Use display: none; in CSS to hide any element in HTML document.

Author

Commented:
but in ASP how could I know in which page is the user navigating, in order to decide when to hide the control?
Mohamed AbowardaSenior Software Engineer
CERTIFIED EXPERT

Commented:
Are you using AJAX?

Author

Commented:
not Jet, but if you show me how I wouldn´t mind to use it
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
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

Author

Commented:
Te code was a little different (C#) but with some adjustments it worked very well.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.