Solved

How to hide a control in a master page?

Posted on 2010-09-04
7
476 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

 

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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

726 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