Solved

How display alternate navbars in asp.net

Posted on 2010-08-24
1
386 Views
Last Modified: 2012-05-10
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

                <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>
-->

Open in new window


Thanks.
0
Comment
Question by:TARJr
1 Comment
 
LVL 2

Accepted Solution

by:
SandyAgo earned 250 total points
ID: 33517004
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)


         
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now