Question : How display alternate navbars in asp.net

I need to have a different navbar load  when a user clicks the Navbar1 or Navbar2 button, see code below from my master page. I'm using asp.net 4.0 (VB) and CSS

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
                <div id="navbarTop">
            <ul>
                <li><a href="../Default.aspx" id="top-home">Home</a></li>
                <li><a href="../About.aspx" id="top-about">About Us</a></li>
                <li><a href="../default1.aspx" id="nav1">Navbar1</a></li>
                <li><a href="../default2.aspx" id="nav2">Navbar2</a></li>
            </ul>
            </div>
<!--this is the default navbar and displayed when user clicks NavBar1 button
            <div id="navbar1">
            <ul>
                <li><a href="../page1.aspx" id="p1">button1</a></li>
                <li><a href="../page2.aspx" id="p2">button2</a></li>
                <li><a href="../page3.aspx" id="p3">button3</a></li>
            </ul>
            </div>
<!--display this navbar when user clicks NavBar2 button
            <div id="navbar2">
            <ul>
                <li><a href="../page4.aspx" id="p4">button4</a></li>
                <li><a href="../page5.aspx" id="p5">button5</a></li>
                <li><a href="../page6.aspx" id="p6">button6</a></li>
            </ul>
            </div>
-->


Thanks.

Answer : How display alternate navbars in asp.net

Firstly, just wrap both navbar1 and navbar2 in <asp:panel ID="..." runat="server" visible="false">

Then in your coe, your navbar1 and navbar2 links both go to different aspx pages. If this is what you are actually trying to do then you can just send the visibility you require back up to the master page during page load. See this article:

http://www.4guysfromrolla.com/articles/013107-1.aspx

hey presto, you can set visible=true when you load from the different pages (default1.aspx and default2.aspx)


         
Random Solutions  
 
programming4us programming4us