473,320 Members | 1,939 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

problem with changing color when logged

Hi,.

i try to change the color of the main menu when the visitor of the site is
logged.
When not logged, it must be red, when logged, it must be green.
I start in the MasteršPage with putting the link to the red CSS file to
Visible and to the green CSS file to False..
In code-behind, i test if the loginview has changed: if yes, i change
Visible to False and inverse .
But it always remains red!
See my code:

Thanks for help
Bjorn

aspx file:
-------
<head runat="server">
<link id="lk1" href="Corered.css" rel="stylesheet" type="text/css"
visible="true" />
<link id="lk2" href="Coregreen.css" rel="stylesheet" type="text/css"
visible="false" />
</head>
<body>
<form id="form1" runat="server">
<div id="Menu"<mai:Mainmenu ID="MMenu1" runat="server" /</div>
<div id="Content">
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder</div>
</div>
<asp:LoginView ID="LoginView1" runat="server">
<AnonymousTemplate>
</AnonymousTemplate>
<LoggedInTemplate>
</LoggedInTemplate>
</asp:LoginView>

code-behind:
-------------
Protected Sub LoginView1_ViewChanged(ByVal sender As Object, ByVal e As
System.EventArgs) Handles LoginView1.ViewChanged
If lk1.Visible = "true" Then
lk1.Visible = "false"
lk2.Visible = "true"
Else
lk2.Visible = "false"
lk1.Visible = "true"
End If
End Sub

Feb 28 '07 #1
3 1242
unless you put a runat=server on the links, the visible tag is
meaningless for a link

-- bruce (sqlwork.com)

Bjorn wrote:
Hi,.

i try to change the color of the main menu when the visitor of the site is
logged.
When not logged, it must be red, when logged, it must be green.
I start in the MasteršPage with putting the link to the red CSS file to
Visible and to the green CSS file to False..
In code-behind, i test if the loginview has changed: if yes, i change
Visible to False and inverse .
But it always remains red!
See my code:

Thanks for help
Bjorn

aspx file:
-------
<head runat="server">
<link id="lk1" href="Corered.css" rel="stylesheet" type="text/css"
visible="true" />
<link id="lk2" href="Coregreen.css" rel="stylesheet" type="text/css"
visible="false" />
</head>
<body>
<form id="form1" runat="server">
<div id="Menu"<mai:Mainmenu ID="MMenu1" runat="server" /</div>
<div id="Content">
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder</div>
</div>
<asp:LoginView ID="LoginView1" runat="server">
<AnonymousTemplate>
</AnonymousTemplate>
<LoggedInTemplate>
</LoggedInTemplate>
</asp:LoginView>

code-behind:
-------------
Protected Sub LoginView1_ViewChanged(ByVal sender As Object, ByVal e As
System.EventArgs) Handles LoginView1.ViewChanged
If lk1.Visible = "true" Then
lk1.Visible = "false"
lk2.Visible = "true"
Else
lk2.Visible = "false"
lk1.Visible = "true"
End If
End Sub
Feb 28 '07 #2
Thanks for replying...
I added on both link runat="server" like you suggested:
<link id="lk1" href="Corered.css" rel="stylesheet" type="text/css
runat="server" visible="true" />
but it still doesn't work.

Wthout that runat="server", if the visible tag would be then meaningless,
then it would be green, not red, because the green-link comes after the
red-link. Am i wrong?

I thing the problem is elsewhere, but where ...


"bruce barker" <no****@nospam.comschreef in bericht
news:Om**************@TK2MSFTNGP03.phx.gbl...
unless you put a runat=server on the links, the visible tag is meaningless
for a link

-- bruce (sqlwork.com)

Bjorn wrote:
>Hi,.

i try to change the color of the main menu when the visitor of the site
is logged.
When not logged, it must be red, when logged, it must be green.
I start in the MasteršPage with putting the link to the red CSS file to
Visible and to the green CSS file to False..
In code-behind, i test if the loginview has changed: if yes, i change
Visible to False and inverse .
But it always remains red!
See my code:

Thanks for help
Bjorn

aspx file:
-------
<head runat="server">
<link id="lk1" href="Corered.css" rel="stylesheet" type="text/css"
visible="true" />
<link id="lk2" href="Coregreen.css" rel="stylesheet" type="text/css"
visible="false" />
</head>
<body>
<form id="form1" runat="server">
<div id="Menu"<mai:Mainmenu ID="MMenu1" runat="server" />
</div>
<div id="Content">
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder</div>
</div>
<asp:LoginView ID="LoginView1" runat="server">
<AnonymousTemplate>
</AnonymousTemplate>
<LoggedInTemplate>
</LoggedInTemplate>
</asp:LoginView>

code-behind:
-------------
Protected Sub LoginView1_ViewChanged(ByVal sender As Object, ByVal e As
System.EventArgs) Handles LoginView1.ViewChanged
If lk1.Visible = "true" Then
lk1.Visible = "false"
lk2.Visible = "true"
Else
lk2.Visible = "false"
lk1.Visible = "true"
End If
End Sub

Feb 28 '07 #3
On Feb 28, 1:16 pm, "Bjorn" <b...@nospam.ukwrote:
Thanks for replying...
I added on both link runat="server" like you suggested:
<link id="lk1" href="Corered.css" rel="stylesheet" type="text/css
runat="server" visible="true" />
but it still doesn't work.

Wthout that runat="server", if the visible tag would be then meaningless,
then it would be green, not red, because the green-link comes after the
red-link. Am i wrong?

I thing the problem is elsewhere, but where ...

"bruce barker" <nos...@nospam.comschreef in berichtnews:Om**************@TK2MSFTNGP03.phx.gbl. ..
unless you put a runat=server on the links, the visible tag is meaningless
for a link
-- bruce (sqlwork.com)
Bjorn wrote:
Hi,.
i try to change the color of the main menu when the visitor of the site
is logged.
When not logged, it must be red, when logged, it must be green.
I start in the MasteršPage with putting the link to the red CSS fileto
Visible and to the green CSS file to False..
In code-behind, i test if the loginview has changed: if yes, i change
Visible to False and inverse .
But it always remains red!
See my code:
Thanks for help
Bjorn
aspx file:
-------
<head runat="server">
<link id="lk1" href="Corered.css" rel="stylesheet" type="text/css"
visible="true" />
<link id="lk2" href="Coregreen.css" rel="stylesheet" type="text/css"
visible="false" />
</head>
<body>
<form id="form1" runat="server">
<div id="Menu"<mai:Mainmenu ID="MMenu1" runat="server"/>
</div>
<div id="Content">
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder</div>
</div>
<asp:LoginView ID="LoginView1" runat="server">
<AnonymousTemplate>
</AnonymousTemplate>
<LoggedInTemplate>
</LoggedInTemplate>
</asp:LoginView>
code-behind:
-------------
Protected Sub LoginView1_ViewChanged(ByVal sender As Object, ByVal e As
System.EventArgs) Handles LoginView1.ViewChanged
If lk1.Visible = "true" Then
lk1.Visible = "false"
lk2.Visible = "true"
Else
lk2.Visible = "false"
lk1.Visible = "true"
End If
End Sub
Try putting your .css in the App_Themes folder of your application and
then in the Page_Load, set the Page.Theme to the appropriate value.

I'm not certain this will work, but was recently reading the docs on
the Page.Theme property.

Chris

Mar 1 '07 #4

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

Similar topics

5
by: sdm | last post by:
Hi I am in the process of moving my website from NT4/IIS4 to Windows 2003. Both server are set to a short date format of (dd/mm/yy) however the Windows 2003 server appears to be ignoring this...
3
by: Deacon | last post by:
Dear all, I am using DB2 for AIX, I have the following problem when migrating my DB from DB2 v7.2 to v8.1 I orginally have a table with a CLOB field with logged and not compact properties. We...
3
by: Steven Fox | last post by:
============================================================ About DB2 Administration Tools Environment ============================================================ DB2 administration tools level:...
0
by: James Griffiths | last post by:
Here is a report I've written about a printing problem that is being experienced by a particular company for whom I had developed a A97 system. After upgrading to Win XP and AXP, some printing...
13
by: Alexandra | last post by:
Hi, I have a hidden system file that I need to read. I am logged in as an administrator. I can not change the file attributes using the windows explorer.
5
by: | last post by:
Hi, I'm trying to use the cookie munging session handling behaviour of asp.net instead of cookies themselves as I'm finding quite a few people are barring cookies (especially AOL users). If I...
4
by: - Steve - | last post by:
I'm trying to change a user's password using objUser.Invoke("setPassword", "newpassword") It works fine as a console application if I'm logged in with someone with the correct permissions. If...
8
by: Kevin D. | last post by:
Please note, I already posted this on the MySQL official forum, but received no response. I thought I'd try again in another location. My apologies to anyone reading this twice... Despite...
3
by: Bjorn | last post by:
Hi,. i try to change the color of the main menu when the visitor of the site is logged. When not logged, it must be red, when logged, it must be green. I start in the MasteršPage with putting...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...

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.