Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
|
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 28th, 2007, 06:21 PM
Friend of Wrox
 
Join Date: Apr 2006
Posts: 160
Thanks: 0
Thanked 0 Times in 0 Posts
Default problem with changing style when user is 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
H.


aspx file:
-------
<head runat="server">
  <link id="lk1" runat="server" href="Corered.css" rel="stylesheet" type="text/css" visible="true" />
  <link id="lk2" runat="server" 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








Similar Threads
Thread Thread Starter Forum Replies Last Post
to keep the user logged in until he sign out sarah lee ASP.NET 1.0 and 1.1 Basics 14 December 14th, 2006 11:55 AM
user logged jonyBravo Access 6 November 27th, 2006 09:14 AM
changing style using javascript mattastic Javascript 3 September 21st, 2004 09:57 AM
Getting the name of the logged on user Grahame2003 C# 2 March 4th, 2004 04:48 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.