Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


How to hide a control in a master page?

Posted on 2010-09-04
Medium Priority
Last Modified: 2012-08-13

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.
Question by:dimensionav
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
LVL 12

Expert Comment

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

Author Comment

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?
LVL 12

Expert Comment

by:Mohamed Abowarda
ID: 33603916
Are you using AJAX?
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.


Author Comment

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

Accepted Solution

teleportator earned 1500 total points
ID: 33609027
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


Author Comment

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


Author Closing Comment

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

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

636 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