473,569 Members | 2,844 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

I need help with Master page - I am working on Header and Side lay out.

Hello,
Here is a little bit of what I am working ...

I have selected Header and Side lay out for my Master Page. All my
links go on the Side and the content on to the right pane. I have no
problem dealing wiht ContentPlaceHol der and the content pages. I also
have created a log in screen using Loin control and this works pretty
well too.

But my problem and where I need help is I need to be able to hide the
site links on the Side pane when the user requested our site. Its
perfectly brings up the Login page if the user is not authenticated but
I dont' know how do I hide the links on the Side when the Login screen
shows up. May be I need to handle the events to hide the links on the
Side pane but no clue how do I do it and what evets when the Login page
appears.
I have a screen shot of my Login page in the Master Page and for better
understanding I can send it over if needed.

Please help.

Thanks in advance,
-L

Mar 9 '06 #1
4 1803
There are a ton of ways to skin a cat. You could
always overwrite the contents of your place holder
that holds the links with an empty space when
certain pages load or some condition is met.

You can reference the place holders in
the master page from within any page that
uses them...

--
Robbe Morris - 2004-2006 Microsoft MVP C#
Earn money answering .NET questions
http://www.eggheadcafe.com/forums/merit.asp

"Learner" <pr****@gmail.c om> wrote in message
news:11******** **************@ v46g2000cwv.goo glegroups.com.. .
Hello,
Here is a little bit of what I am working ...

I have selected Header and Side lay out for my Master Page. All my
links go on the Side and the content on to the right pane. I have no
problem dealing wiht ContentPlaceHol der and the content pages. I also
have created a log in screen using Loin control and this works pretty
well too.

But my problem and where I need help is I need to be able to hide the
site links on the Side pane when the user requested our site. Its
perfectly brings up the Login page if the user is not authenticated but
I dont' know how do I hide the links on the Side when the Login screen
shows up. May be I need to handle the events to hide the links on the
Side pane but no clue how do I do it and what evets when the Login page
appears.
I have a screen shot of my Login page in the Master Page and for better
understanding I can send it over if needed.

Please help.

Thanks in advance,
-L

Mar 9 '06 #2
Hello Rob,
Thank you for the quick reply. Yes your second paragraph helped me to
establish the fact that we can control the Master page display from any
of its content pages.

Here is what I have done:

I have put the all the links in a contentPlaceHol der and named it
LINKS.

And in the Login.aspx content page I refered the above LINKS
contentPlaceHol der and mentioned nothing in there and there you go it
doesn't display the links now :)

Here is my Login.aspx content page html code

<%@ Page Language="VB" MasterPageFile= "~/MasterPage.mast er"
AutoEventWireup ="false" CodeFile="MainL ogin.aspx.vb"
Inherits="UnSec ured_MainLogin" title="Untitled Page" %>
<asp:Content ID="linksConten t" ContentPlaceHol derID="LINKS"
runat="server">
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHol derID="ContentP laceHolder1"
Runat="Server">
<asp:Login ID="Login1" runat="server"
CreateUserUrl=" ~/UnSecured/CreateNewAcct.a spx">
</asp:Login>
</asp:Content>

as you the LINKS contentPlaceHol der is empty. So when ever this
Login.aspx appears my links won't display.

Hope the way I handled it is the correct way. If not please advise how
do I do it right.
I also tried doing it from the codebehind page of the Master page as
below

Protected Sub form1_Load(ByVa l sender As Object, ByVal e As
System.EventArg s) Handles form1.Load
If ContentPlaceHol der1.Page Is "MainLogin.aspx " Then
_lnkNewVehicle. Visible = False
_lnkReturnedVeh icles.Visible = False
End If
End Sub

But it doesn't work and the way I have written the code is wrong. I
know that but I don't know how to handle it in the code behind page.

If you have couple of mins please help me how to handle it in the code
behind page and it helps me to understand to better handle the Master
page event in future.

Thanks for the help,
-L

Mar 9 '06 #3
You will most likely need to run this code in the PreInit event of
the page.

C# syntax

protected void Page_PreInit(ob ject sender, EventArgs e)

--
Robbe Morris - 2004-2006 Microsoft MVP C#
Earn money answering .NET questions
http://www.eggheadcafe.com/forums/merit.asp

"Learner" <pr****@gmail.c om> wrote in message
news:11******** **************@ z34g2000cwc.goo glegroups.com.. .
Hello Rob,
Thank you for the quick reply. Yes your second paragraph helped me to
establish the fact that we can control the Master page display from any
of its content pages.

Here is what I have done:

I have put the all the links in a contentPlaceHol der and named it
LINKS.

And in the Login.aspx content page I refered the above LINKS
contentPlaceHol der and mentioned nothing in there and there you go it
doesn't display the links now :)

Here is my Login.aspx content page html code

<%@ Page Language="VB" MasterPageFile= "~/MasterPage.mast er"
AutoEventWireup ="false" CodeFile="MainL ogin.aspx.vb"
Inherits="UnSec ured_MainLogin" title="Untitled Page" %>
<asp:Content ID="linksConten t" ContentPlaceHol derID="LINKS"
runat="server">
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHol derID="ContentP laceHolder1"
Runat="Server">
<asp:Login ID="Login1" runat="server"
CreateUserUrl=" ~/UnSecured/CreateNewAcct.a spx">
</asp:Login>
</asp:Content>

as you the LINKS contentPlaceHol der is empty. So when ever this
Login.aspx appears my links won't display.

Hope the way I handled it is the correct way. If not please advise how
do I do it right.
I also tried doing it from the codebehind page of the Master page as
below

Protected Sub form1_Load(ByVa l sender As Object, ByVal e As
System.EventArg s) Handles form1.Load
If ContentPlaceHol der1.Page Is "MainLogin.aspx " Then
_lnkNewVehicle. Visible = False
_lnkReturnedVeh icles.Visible = False
End If
End Sub

But it doesn't work and the way I have written the code is wrong. I
know that but I don't know how to handle it in the code behind page.

If you have couple of mins please help me how to handle it in the code
behind page and it helps me to understand to better handle the Master
page event in future.

Thanks for the help,
-L

Mar 9 '06 #4
On 8 Mar 2006 17:29:23 -0800, Learner wrote:
But my problem and where I need help is I need to be able to hide the
site links on the Side pane when the user requested our site.


I assume you want to hide the links when the user is not logged in,
correct?

If so, simply add this code to the page_load even of the master page
(assuming vb):

If Not User.Identity.I sAuthenticated then
links.visible = False
End IF

You'll need to name the div (or whatever element) your links are contained
in to ID="links" and add a runat="server".
Mar 10 '06 #5

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

Similar topics

1
1762
by: Hasani \(remove nospam\) | last post by:
The way the system works is, you create a user control (ascx) that will be a template and must implement the interface IPageTemplate. You then create one or more user controls (ascx) that implement the IPageContent interface. A page (aspx) must then be created that loads (using Page.LoadControl) the page template, and the page content. The...
4
1862
by: EagleRed | last post by:
I am writing an ASP.NET 2.0 application that uses more than one master page. Currently, there are two pages, Freedom1.master and Freedom2.master. I have no problems with Freedom1.master. However, I am having problems with Freedom2.master. The first problem is I sometimes get the following error when I build the site. The type...
11
12098
by: EagleRed | last post by:
I am writing an ASP.NET 2.0 application that uses master pages. I have some pages that must not be cached on the client. In ASP.NET 1.1 I achieved this using metatags: <meta http-equiv="Expires" content="0"> <meta http-equiv="Pragma" content="no-cache"> <meta http-equiv="Cache-Control" content="no-cache"> This tags are part of the...
7
1908
by: rockdale | last post by:
Hi, How do you guys deal with the different clinet resolution? For example, you have 800*600, 1024*768 and 1280*1024 on client side. We used to put everything into a table with fixed width (the lowest width of your clients' resolutions) then put everything inside the table with a percentage width. But for those clients with higher...
0
1700
by: dhurwitz | last post by:
Hi, In my ASP.NET 2.0 web app, I have a user control, ucBinEdges, with several text boxes. The user control has several validation controls validating the Text of these text boxes - CompareValidator, RangeValidator, RequiredFieldValidator, and a ValidationSummary. The page using ucBinEdges is a content page working in conjunction with a...
4
2778
by: Suresh | last post by:
Is there any way to access the custom properties of a master page from the aspx form? I know the custom properties of a master page can be accessed from the aspx.cs partial class by specifying the MasterType directive on the aspx form. My master page will render a custom navigation menu and I'd like to put in the properties of which tab...
1
1863
by: Asif | last post by:
Hi All, I did follow the MSDN article (http://msdn2.microsoft.com/en-us/ library/ms379585(VS.80).aspx ) for overriding Master Page properties by setting page title and other Meta information( Keyword and Description) for individual content page by writing the following line on Page_Load event in content page Sub Page_Load()
7
1350
by: =?Utf-8?B?TWFyaw==?= | last post by:
keywords: asp.net master page rubbish I have written a custom control. The control is a simple html Tab menu control. The control inherits from DataBoundControl and implements INamingContainer, IPostBackEventHanlder and IPostBackDataHandler. The control is engineered to use a hidden client-side input textbox which stores a selected index...
1
8465
by: sudip2008 | last post by:
When using the Calendar Popup in a content page of a masterpage the strForName is always set to aspnetForm This breaks this line from working properly window.opener.document.forms...... How can I fix this and display the date into textbox after selecting the date from Calendar.aspx? This Very Urgent .......................... If any body...
0
7695
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8119
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7964
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
6281
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...
0
5218
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...
0
3637
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2111
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 we have to send another system
1
1209
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.