Welcome to PhoneASK, where you can ask questions and receive answers from other members of the community.

how to select menu item.sub item through c# code

asked 一月 12 at 06:15 by self
I am developing c# web application .net frame work 4.5.

I have created a menue control through following code.

<asp:Menu ID="DropDownMenu" runat="server" OnMenuItemClick="DropDownMenu_MenuItemClick" Orientation="Horizontal">
            <DynamicHoverStyle BackColor="Green" />
                <asp:MenuItem Text="Home" Value="Item1">
                    <asp:MenuItem Text="Sub Item1" Value="Sub Item1"></asp:MenuItem>
                    <asp:MenuItem Text="Sub Item2" Value="Sub Item2"></asp:MenuItem>
                    <asp:MenuItem Text="Sub Item3" Value="Sub Item3"></asp:MenuItem>
                <asp:MenuItem Text="Functions" Value="Item5">
                    <asp:MenuItem Text="Reverse Complement" Value="Sub Item1"></asp:MenuItem>
                    <asp:MenuItem Text="Translation" Value="Sub Item2"></asp:MenuItem>
                    <asp:MenuItem Text="Reverse Translation" Value="Sub Item3"></asp:MenuItem>
                    <asp:MenuItem Text="Orf finder" Value="Sub Item4"></asp:MenuItem>
                    <asp:MenuItem Text="In Silico PCR" Value="Sub Item5"></asp:MenuItem>

The problem is that i dont know how to select a specific menu item or sub item.
e.g if i select menu sub item"translation", it should go on a new page.

would any one guide me please that how to select menue items and sub items through c# code ????


Your answer

1 Answers

answered 一月 12 at 15:43 by David V
You need to use Selected property of a MenuItem.

Refer: MSDN: MenuItem.Selected Property [ ^]

Related Questions

I'm building an Applescript that will scan my network every X minutes, checking for my house's Xbox360 or PS3 and enabling my Transmission BitTorrent client Speed-Limit Mode when either console is onl
I'm trying to style only ONE menu item on my website. I have a contact us menu item on my WordPress website that I'm trying to change to color #FF860C. I just tried this but no go: li#menu-item-155
In the Visual Studio designer, how do you move a menu item from one menu to another? I would assume DnD would work, but it seems to only work within a menu for me. I usually resort to editing the .Des
I have 2 options menu items added using the following code. onCreateOptionsMenu(Menu menu) { menu.add(ITEM1); menu.add(ITEM2); ... } How can set context menu for one of these menu items. Normally
maybe a stupid question here but my html skills are faded now.. :) I am creating a KML file with a button click and all the code for the KML tags is there. What I need is using more than one tags. It
When my app loads, I want the first item in the listview to already be selected. how can I do this?
How do you achieve this kind of menu: About | Privacy | Contact | Site Map ... a menu separated by a vertical bar, but the first and last item doesn't have a bar on the left and right sides (as shown
I have an MvvmCross PCL and a related MonoDroid UI project (pattern copied from following Stuart Lodge's excellent N+1 video series). I want to bind the click of an Action Bar menu item to an ICommand
my action bar; <item android:id=@+id/userMenuItem android:orderInCategory=100 android:showAsAction=ifRoom|withText> <menu> <item android:id=@+id/logout android:title=@string/
How would I add a link to my menu item in wxpython? What I want is when the user clicks the menu item it will go to my website. Is this even possible? Thanks in advance!! Oh and I am fairly new to pro
So i noticed that in awt there is a MenuItem constructor for adding a CTRL + (some key) shortcut, but there is no such constructor for JMenuItem. What is the correct way to do this? I need an equivele
Playing around with building a Chrome extension. At the moment I've put together a context menu item. When the context menu item is clicked, it fires itemClicked() in my background script context_menu
I am outputting to stdout. How can I redirect that to a new file through code? While we run the program we can redirect like ./sample > test.txt. How can I do this when executing the sample program
I'm a person that learns best from example. Currently, I'm diving into the field of Web Development after fifteen years of developing desktop apps. I'm still getting used to all the web technologies u
Is it possible to use Lucene Search in Sitecore and have the results returned as JSON by the Sitecore Item Web API? The documentation for the Sitecore Item Web API on the Sitecore Developer Network do
I am working on something that requires a selection to be made from a list view and then selects the item from a SQL Server database based on column 1 (or ii) and then rewrites it to a local datatable
I wonder, is it possible to show Select one by default as selected option but hide from options list when user clicks to open select menu? I mean, something like placeholderfor text input field. Is
Using Javascript how would I append an option to a HTML select menu? e.g to this: <select> <option value=volvo>Volvo</option> <option value=saab>Saab</option> <opt
I have a listbox where I want to copy and paste items within that listbox. Copy and paste works fine but everytime I press Crtl + C the item starting with the letter C is automatically selected. Can
For part of a large university project I have built a large java based application. To make installation cleaner I am aiming to write a script to copy the jar to a hidden file in the users home dire
Is it possible, in magento, to remove a menu item in admin? I have a new module and am pulling the reviews and ratings into a new section. I'm not opposed to leaving them also in the catalog section,
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.main_menu, menu); return true; } @Override public boolean onOptionsItemSele
I want to add a new menu item to TinyMCE's context menu, and perform a command when the user clicks it, so far i have this, which is not working: tinyMCE.init({ ... setup : function(ed) { ed.onContext
How can I determine the page I am currently on in Lift? In django, for example, in my base template I had simple checks like these: <li {% ifequal main_navigation home %} class=selected{%endife
I've been reading this site many times for a while. It's been always quite helpful for lots of things. So thank you guys! I'm having an issue that I can't manage to solve. I've been deeply looking thr
We're working with jsTree (revision 236 from 09/02/2011). Does anyone know if there is any way to access the menu item name selected in the function associated with the action? I want to automate th
I have a really simple extension and I want to show a new item on the context menu depending on the content, that should be pretty simple and there are a lot of tutorials showing how this must be done
I'm currently writing an application where I need to modify the context menu of windows explorer so that I can call a method within the application to be used on all files/folders that are seen in win
Hi I want to browse to a file explorer and select a pdf or image present in some directory. I want the code to do the same. the below code takes me to gallery and help me choose image but I want to mo
I have an XML file that contains a script of items to check and validate. What it does is reads in a value to check, and if that check is true, it does something. I originally wrote this to work wit
I have an array of fields (not rows!) I want to loop through, in a table, in a predefined order, backwards (alternatively, I could reverse the order of the array) and return the field name of the firs
I searched the Internet for quite a while without finding a solution. I want to let the user pick images of his gallery using an intent. For this i use a GET_CONTENT intent: Intent intentBrowseFiles =
My Source page : <asp:DataList ID=datalist RepeatColumns=6 runat=server > <ItemTemplate> <div class=rating> <div> <cc1:Rating ID=Rating1 AutoPostBack=true OnCha
Can you please tell me how can I create an android menu item using android setting icon? Thank you.
I am writing a custom NSMenuItem view that I would like to make accessible. When I do not override accessibilityIsIgnored (so the NSView default of YES is returned), I see in Accessibility Inspector t
with my custom drupal-module i'm trying to insert add a menu-item to a menu using hook_menu(). It should display the user-name linked to the user-profile. (My task could be similar to Add menu item/li
I tried this on my own but couldn't get it to work right. Basically I am making an edit page where a previously submitted post can be edited. On this new page the form is pre-populated with previously
Currently, I'm setting the volume to max, and then checking if the volume is at max, or a lower value. If it's at a lower value, then the user must have a Volume Lock on their system. This works fine,
I am trying to change select option border but unable to do that, I have tried it many times but not find the proper solution. I have attached the screen shot . <head> <style> select opti
Possibly a silly question, but how do I prevent a select element in a form from showing its drop down menu when it's clicked on? I tried the following: $('select').click (function (e) { console.log (e
I'm trying to write a test for a little Rails app I'm working on. The Users model has a has_many through relationship (both ways) with other users and users have a has_many relationship with assignmen
Oh, man. I'm feeling the WPF pain this week. So for my next trick, I'm now unable to figure out how to select an item programmatically in a ListView. I'm attempting to use the listview's ItemContainer
I can't find either the term autocomplete or intellisense in Preferences->General->Keys in Eclipse 3.6.2. I don't want to press enter to select an autocomplete item when I write code. Can I conf
This is a very simple question and i'm sure a very simple fix. I have not really used drop menus at all and so have no idea how to change this. All I want to do is to stop the displayed menu item from
I am trying to use option menus for my application . When I add 2 MenuItem it shown in a single row, but i need only one item in a row and other in next row. Please help me. Thanks..
What is the difference between MENU_NORMAL_ITEM and MENU_CALLBACK?
I have a number crunching application written in C. It is kind of a main loop that for each value calls, for increasing values of i, a function that performs some calculations. I read about multithr
I am using Task Scheduler for scheduling my task in c# application. I think i got the basic understanding of this library. But now i stuck in a place where i want to create a custom action which will
I'm currently trying to do a basic mysqlcheck through the command prompt. The mysql.exe file itself is within a bin that the working directory is pointing towards to use as part of the commands though
I made a Desktop application. I made it using Netbeans 7 IDE. In it, I have created a menu called look and feel. I created it by dragging the menu from palette. The menu items are Window,Metal and Mo