Link to home
Create AccountLog in
Avatar of dimensionav
dimensionavFlag for Mexico

asked on

How to hide a control in a master page?

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.
Avatar of Brad Brett
Brad Brett
Flag of United States of America image

Use display: none; in CSS to hide any element in HTML document.
Avatar of dimensionav

ASKER

but in ASP how could I know in which page is the user navigating, in order to decide when to hide the control?
Are you using AJAX?
not Jet, but if you show me how I wouldn´t mind to use it
ASKER CERTIFIED SOLUTION
Avatar of teleportator
teleportator

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
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

Te code was a little different (C#) but with some adjustments it worked very well.