473,503 Members | 4,692 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to disable Master Page controls on Login Page?

I have created a Login Page with Master.Master Page. The master page
contains Menus, and I want to disable those menus on Login Page, how can I
?

Best Regards,

Luqman
Jul 5 '07 #1
6 17360
"luqman" <pe*******@cyber.net.pkwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
>I have created a Login Page with Master.Master Page. The master page
contains Menus, and I want to disable those menus on Login Page, how can I
In the Page_Load of your Login page you can refer to the controls on its
MasterPage as follows:

Menu MyMasterMenu = (Menu)Master.FindControls("MyMenu");

Then you can do anything you like with it...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jul 5 '07 #2
Expose a property from the master page i.e.

public bool ShowMenu
{
get
{
return myMenu.Visible;
}
set
{
myMenu.Visible = value;
}
}

On the page you utilize your master, use <@ MasterType directive to
specify the type your master is:

<@ MasterType Type="myMasterPageType" >

and then, in the page code you can use your property:

this.Master.ShowMenu = true;

Mark's approach is relatively simpler, but it won't work if the menu is
nested in a container, it's not supported by the intellisense and compiler,
and you need to know the control structure of the master page (including IDs).

hope this helps
--
Milosz
"luqman" wrote:
I have created a Login Page with Master.Master Page. The master page
contains Menus, and I want to disable those menus on Login Page, how can I
?

Best Regards,

Luqman
Jul 5 '07 #3
"Milosz Skalecki [MCAD]" <mi*****@DONTLIKESPAMwp.plwrote in message
news:2F**********************************@microsof t.com...
Mark's approach is relatively simpler, but it won't work if the menu is
nested in a container,
Surely the programmer would know how to find controls on a page no matter
how deeply they were nested in other containers... :-)

Also, the OP was asking how to disable the Menu, not make it visible or
invisible...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jul 5 '07 #4
Hi there,

I agree Mark, but i've seen this apporach causing problems when other
developers changed the master. From my point of view, using property it's
much more reliable because property is transparent for the caller, and any
bugs will be intercepted by the compiler. In addition, if the menu is put
inside a container, you would have to use $ separator to find the control
which is another source of bugs if control tree on master changes. Anyway,
both solutions are valid.

Best regards
--
Milosz
"Mark Rae [MVP]" wrote:
"Milosz Skalecki [MCAD]" <mi*****@DONTLIKESPAMwp.plwrote in message
news:2F**********************************@microsof t.com...
Mark's approach is relatively simpler, but it won't work if the menu is
nested in a container,

Surely the programmer would know how to find controls on a page no matter
how deeply they were nested in other containers... :-)

Also, the OP was asking how to disable the Menu, not make it visible or
invisible...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jul 5 '07 #5
"Milosz Skalecki [MCAD]" <mi*****@DONTLIKESPAMwp.plwrote in message
news:02**********************************@microsof t.com...
From my point of view, using property it's much more reliable because
property is transparent for the caller, and any bugs will be intercepted
by the compiler.
Fair enough.
In addition, if the menu is put inside a container, you would have to use
$ separator to find the control
Not so...

Menu MyMasterMenu =
(Menu)Master.FindControl("MyContainer").FindContro l("MyMenu);

However, I agree that that is pretty dreadful... :-)
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Jul 5 '07 #6
If the MasterPage menus are in defined ContentPlaceholder controls, then a
blank Content control with that id in the login page will override what's in
the master and nothing will display.
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder(BETA): http://www.blogmetafinder.com

"luqman" wrote:
I have created a Login Page with Master.Master Page. The master page
contains Menus, and I want to disable those menus on Login Page, how can I
?

Best Regards,

Luqman
Jul 5 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1436
by: Divya | last post by:
Hi all, I have an user.asp page(has html display) which displays the controls; After client-side validations, I do a document.form.submit() to a process asp page(no html, only server side...
1
1541
by: Philippe Meunier | last post by:
My web.config looks like this concerning login : <authentication mode="Forms"> <forms loginUrl="frmLogin.aspx" timeout="20" /> </authentication> <authorization>
2
3955
by: Stephen Miller | last post by:
I have an ASPX report and I want to capture the rendered HTML and write to a file on the webserver. Several posts suggest using WebRequest to make a second call to the page, and screen-scrape the...
2
1979
by: Gary Coutts | last post by:
Hi, I am have problems redirecting from a login page. The login page is simple, with just 2 textboxes and one button. On the button click the routine below is called: I am using: Visual...
2
4210
by: Sasquatch | last post by:
I'm having trouble creating a simple login page using the asp:login control. I followed some instructions in a WROX book, "Beginning ASP.NET 2.0," and the instructions are very straight forward,...
11
3857
by: Bazza Formez | last post by:
Hi, I have an app which utilizes forms security. I have a Login.aspx page which references my MasterPage.master. The master page in turn references a css. In the designer of VS 2005, the...
3
6672
by: Ghanathe | last post by:
Hello!!! Can any one tell how to retrieve user name and other details like first name,address,contact no. and so on.... and display in welcome page after login page using c# and sql server...
1
1476
by: simon2x1 | last post by:
i have two page the login page(login.php) and the userpanel page(userpanel.php) in the login page whenever i put in the username and password then i click submit it will get the userpanel page but...
2
6015
by: jesposito | last post by:
I have seen numerous posts with this problem, however none of the solutions have worked for me. I am using asp.net 4.0 forms authentication. I have the following set in my config file. ...
0
7207
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7093
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7291
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7012
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5598
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5023
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4690
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3180
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1522
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.