Wrox Programmer Forums
|
Visual Basic 2005 Basics If you are new to Visual Basic programming with version 2005, this is the place to start your questions. For questions about the book: Beginning Visual Basic 2005 by Thearon Willis and Bryan Newsome, ISBN: 0-7645-7401-9 please, use this forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Basic 2005 Basics 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 March 2nd, 2007, 10:29 AM
Friend of Wrox
 
Join Date: Apr 2006
Posts: 160
Thanks: 0
Thanked 0 Times in 0 Posts
Default what's wrong with this code?

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
what's wrong with my code? DyerOppenheimer BOOK: Beginning Ajax with ASP.NET 0 January 7th, 2008 08:46 AM
What's wrong with this code? appleseed C++ Programming 2 November 25th, 2006 08:17 AM
What's wrong with this code? AlDugan XSLT 3 May 19th, 2006 12:06 PM
What is wrong with code? rtr1900 Classic ASP Databases 1 April 3rd, 2006 03:20 AM
what's wrong with this code? miguel.ossa ASP.NET 1.0 and 1.1 Basics 2 January 21st, 2004 11:33 AM





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