473,569 Members | 2,772 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 17373
"luqman" <pe*******@cybe r.net.pkwrote in message
news:%2******** ********@TK2MSF TNGP03.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.Fi ndControls("MyM enu");

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="myMasterP ageType" >

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

this.Master.Sho wMenu = 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*****@DONTLI KESPAMwp.plwrot e in message
news:2F******** *************** ***********@mic rosoft.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*****@DONTLI KESPAMwp.plwrot e in message
news:2F******** *************** ***********@mic rosoft.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*****@DONTLI KESPAMwp.plwrot e in message
news:02******** *************** ***********@mic rosoft.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.Fi ndControl("MyCo ntainer").FindC ontrol("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 ContentPlacehol der 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
1438
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 processing and then redirects to the user.asp). This process asp calls some dll functions which might take a couple of hours if number of records to...
1
1543
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
3963
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 resulting HTML. The technique typically described is: '-- Get the current URL and request page Dim url As String =...
2
1984
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 Studio 2003 Version 7.1.3008 Framework 1.1 Version 1.1.4322 SP1 Windows XP Pro Version 2002 SP2
2
4218
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, but it won't work for me. Here's what I did. 1. Created a new folder named "testlogin" 2. Turned that folder into an application using the IIS...
11
3860
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 Login page renders correctly.... with correct formatting as provided by my css. At application runtime however, all formatting disappears on the login
3
6681
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 plzzzzzzzzzzzz Thanking u Regards, Deepshika
1
1485
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 the problem is whenever i am in the userpanel page and i click the back option on top of the browser it will take me back to the login page how can i...
2
6025
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. <authentication mode="Forms"> <forms loginUrl="~/Account/Login.aspx" /> </authentication> <authorization> <deny users="?"/> ...
0
7924
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7672
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7968
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6283
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5512
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5219
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1212
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
937
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.