473,770 Members | 2,096 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Menu Control + asp.net

41 New Member
Hi...

i have added 5 menu items in my menu control dynamically from database.when i click Item1 it redirect me to Page1 and Item1 color changes to selected.

when i click Item2 it redirect to Page2 and Item1 color changes to selected.

But still Item1 colors is selected. I just want only one menu item should be with selected item style.

plz help me.

............... ............... ............... ............... ............... ............... .......
Expand|Select|Wrap|Line Numbers
  1. <asp:Menu ID="Menu1" runat="server" DynamicHorizontalOffset="2" Font-Names="Verdana"
  2.                     Font-Size="0.85em" MaximumDynamicDisplayLevels="0" Orientation="Horizontal" StaticSubMenuIndent="10px"
  3.                     Style="height: 15px; text-align: center; width: 100%;">
  4.                     <StaticHoverStyle BackColor="LightSkyBlue" ForeColor="Black" />
  5.                 </asp:Menu>
............... ............... ............... ............... ............... ............... ........
Expand|Select|Wrap|Line Numbers
  1.                     foreach (DataRow dtRow in dsMenuList.Tables[0].Rows)
  2.                     {
  3.                         MenuItem mnuItem = new MenuItem();
  4.                         mnuItem.Text = dtRow["MenuText"].ToString();
  5.                         mnuItem.NavigateUrl = dtRow["NavigateUrl"].ToString(); ;
  6.                         mnuItem.Selected = false;
  7.                         if (mnuItem.NavigateUrl.Contains(Request.RawUrl.ToString()))
  8.                             mnuItem.Selected = true;
  9.                         Menu1.Items.Add(mnuItem);
  10.                     }
Mar 5 '09 #1
3 3810
alamodgal
38 New Member
set this property after Menu1.Items.Add (mnuItem);
Menu1.StaticSel ectedStyle.Fore Color = System.Drawing. Color.Black;
Menu1.StaticSel ectedStyle.Back Color = System.Drawing. Color.Red;

You change colors according to ur need.
Mar 5 '09 #2
alamodgal
38 New Member
And also give forecolor property of menu control
Mar 5 '09 #3
Question123
41 New Member
@alamodgal
Hi....

Thanks for reply.

and its working well.

Thanks a lot :)
Mar 5 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
3277
by: zapazap | last post by:
Dear Snake Charming Gurus, (Was: http://mail.python.org/pipermail/python-list/2004-January/204454.html) First, a thank you to Tim Golden, Thomas Heller, and Mark Hammond for your earlier help with this problem. I am uncertain about what etiquette calls for, but more on that later. My Objective: I am trying to control the _VMWare Desktop_ application
6
3237
by: Sandy | last post by:
Hello - I have a book that illustrates pulling menu items from a Sql Server table into an ascx via a stored procedure. Is this something that is done in the real world? I do like the effect when viewing it in the source code, however, because it doesn't show the complete path to the file. (I'm talking about Internet Explorer click View, click source code.)
7
2707
by: Chuck Hartman | last post by:
I have a Windows service that requests web pages from a site using an HttpWebRequest object. When I try to request a page from an ASP.NET 2 site, I get a WebException with message "The remote server returned an error: (500) Internal Server Error." I found a post that suggested to catch the WebException to retrieve the actual HttpWebResponse object for more information. The response returned is shown below. At first I thought this was a...
5
2625
by: dpomt | last post by:
When the ASP.NET menu is rendered on downlevel browers, the text "^ up one level" is displayed. Any ideas how I can change that text? I did not find a property for the menu control where I can change it. Dieter
17
2360
by: GS | last post by:
the main menu in the application seemed to disappeared all together until I click on an control and select mainmenu1 in designer. then the mainmenu1 displays where it should be but running it or deselecting the mainmenu1, the menu disappears again. what can I do. to fix the problem
3
2113
by: John | last post by:
Hi there, I was reading an article (http://avenuea-razorfish.com/articles/TheAll-MenuNavigation_Turbek.pdf) on 'all-menu navigation' and I'd like to try and implement this in my site. Can anyone recommend how to get started? Is there an Ajax control available for this or would more a basic javascript work just as well. I'm assuming I just need a div element that is shown on a mouse over, but I'm not sure how to go about aligning all...
5
6181
by: Brad Isaacs | last post by:
Good morning friends, I am working with ASP.NET 2.0 -- VB code behind I have created tabbed pages using the Menu control with the Multiview control. Using the menu control to display the tabs, and the Multiview control to display the content that corresponds to the selected tab. My Menu control needs to be able to switch language from English or French depending on the language chosen by the user.
2
5908
by: MCM | last post by:
I'm working on a plotting control. The plotting control will have a context menu with basic commands for "scaling", "zooming", etc. Is there a way that, from the parent form, I can add more commands to the control's context menu? I'm envisioning a case where the control has a set of context menu items, and the parent form also has a set of context menu items. Thanks.
5
1610
by: AG | last post by:
I realize that the obvious suggestion would be malware, but my definitions are up to date and I have already scanned for it. I have also tried disabling all IE add-ons. I just rebuilt and deployed my website (WAP) in ASP.NET 2.0. Everything is working fine except from my development machine with IE6. The master page contains a Menu control bound to a SiteMapDataSource. There is also a row of links (plain links, no menu control) at the...
4
4072
by: SAL | last post by:
Hello, is there a way to menu control dynamically center itself horizontally on a page? I have placed a menu control in a panel control (no ajax) and would like it to center itself. Depending on whose logged in, the menu, or course, displays different items, sometimes just two items, other times many more. If all menu items are displaying, centering is not a problem but when only two items are displayed, the menu appears on the left hand...
0
9618
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10260
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10038
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8933
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7456
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6712
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2850
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.