Avatar of dimensionav
dimensionav
Flag 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.
ASP.NETVisual Basic.NET

Avatar of undefined
Last Comment
dimensionav

8/22/2022 - Mon
Brad Brett

Use display: none; in CSS to hide any element in HTML document.
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?
Brad Brett

Are you using AJAX?
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
dimensionav

ASKER
not Jet, but if you show me how I wouldn´t mind to use it
ASKER CERTIFIED SOLUTION
teleportator

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
dimensionav

ASKER
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

dimensionav

ASKER
Te code was a little different (C#) but with some adjustments it worked very well.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.