.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Passing value from Menu item to my sql

Posted By:      Posted Date: September 10, 2010    Points: 0   Category :ASP.Net
How do I pass the value from my menu item to my sql in the back code? Here's what I have so far. Thank you very much. <div> <asp:Menu id="Menu1" runat="server" BackColor="#CC0000" BorderColor="#CCCCCC" OnMenuItemClick="Menu1_MenuItemClick" BorderStyle="Solid" DynamicHorizontalOffset="2" Font-Bold="True" Font-Names="Tahoma" Font-Size="12pt" ForeColor="White" Height="50px" Orientation="Horizontal" StaticSubMenuIndent="10px" Width="100%"> <StaticMenuStyle BorderColor="White" BorderStyle="Solid" BorderWidth="1px" /> <StaticSelectedStyle BackColor="#FF9900" /> <StaticMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" BorderColor="White" BorderStyle="Solid" BorderWidth="3px" /> <DynamicHoverStyle BackColor="#284E98" ForeColor="White" /> <DynamicMenuStyle BackColor="#B5C7DE" /> <DynamicSelectedStyle BackColor="#507CD1" />

View Complete Post

More Related Resource Links

How to keep the hover for Parent menu and set the selected menu item css for child menu item?



I'm using cssfriendly control adapter for menu. My asp.net menu control's datasource is a sitemap file I'm using which contains all the urls.

I have the following questions:

  1. Is there a way to keep the parent menu item hovered while hovering over the respective child menu items?
  2. Is there a way to keep the child menu item selected? I am able to set the css for the parent menu, however I was wondering if the same is possible with the child items.

Please help! Smile


Moneka Smile

ASP.NET 4.0 Menu Top Level selected item style


I want to apply a css class to the level 1 menu item (parent) when it or any or it's children are selected.

I've looked at MSDN documentation and any number of examples and walkthroughs but I haven't come up with a way of managing this. I was thinking something like this might work but the style is not being applied to the parent. To further complicate matters, if I try to apply a css style to StaticSelectedStyle it doesn't pick it up at all.

Menu Markup:

<StaticSelectedStyle  Font-Bold="True" ForeColor="#3333CC" />

Code Behind:

        protected void MenuItemClick_NavMenu(Object sender, MenuEventArgs e)


            MenuItem parentItem = e.Item.Parent;

            if (parentItem != null)


                parentItem.Selected = true;



Remove action that appear in the menu which appears when we right click each individual item in libr

i need to remove or hide edit properties menu from  menu which appears when we right click each individual item in library 

Creating a new document in Document Library from custom menu item (in the ECB)

Hello! I created a custom menu item in the ECB for a document library. I'd like for this to create a new document from this menu item. Additionally, I'd like to create a workflow where the Title of the document from which the menu action originates is inserted into a custom textfield in the new document that is created. Is this possible using SharePoint Designer?

Menu Item Spacing

I'm trying to use the menu control for the first time in ASP.NET and everything is fine except for the fact that I can't seem to change the item spacing property. My menu is a horizontal menu where the menu items have come from a sitemap file. I've tried changing the menu item spacing in both the dynamic and state menu item properties but nothing seems to change it. I've also tried changing the item spacing via css but that doesn't work either. Any ideas why this might be?<asp:Menu ID="mnuNavigation" runat="server" DataSourceID="mnuNavigationDataSource" Font-Names="Corbel" Font-Size="16pt" Orientation="Horizontal"> <StaticMenuItemStyle ForeColor="White" /> </asp:Menu> <asp:SiteMapDataSource ID="mnuNavigationDataSource" runat="server" ShowStartingNode="False" />

Menu selected item formatting problem in mozilla

Hello, I have a problem with menu slected item. when i click on menu item it shold display in different color for that i hv wrote below code in my master page cs file. on page load.  string thispage = this.Page.AppRelativeVirtualPath; int slashpos = thispage.LastIndexOf('/');string pagename = thispage.Substring(slashpos + 1); string pagename = thispage.Substring(slashpos + 1); foreach (MenuItem mi in Menu7.Items) { if (mi.NavigateUrl.Contains(pagename)) mi.Selected = true; break; } this works fine in IE but when i run in firefox my page formatting disturbs means the content page not coming in a proper place. thanx in advance. do the needfull.         

Menu item and ViewModel pattern

Dear all, I need to build a ViewModel class for a Menu. For that menu I will have to provide information based on MenuItems collection and also handling the click event. Any advide on how to define my vieModel for that menu ? Thnaks for help regards SergeYour knowledge is enhanced by that of others.

Cannot access Workflow from List Item menu: "Value does not fall within the expected range."


We are using Sharepoint 2007 sp2.

I am using Sharepoint Designer 2007 to create workflow for some List, suddenly I cannot acess some list items' workflow,and was informed  "Value does not fall within the expected range." , but other items are all ok.

I don't know whether this is concerned with the service pack 2, I installed sp2 yesterday.

Dynamic menu item in MenuItemTemplate (in SPGridView)




I am implementing a SPGridView in a webpart and would like to have dynamic row menus (with different menu items) based on some cell values. It seems that the answer is in the very-poorly documented property HiddenScript of a MenuItemTemplate object, which contains a custom javascript function which should return true if the menu item should be hidden, or false otherwise.


My question is - how do I pass arguments to this custom javascript function? This is how the sample code looks like:


SPMenuField colMenu = new SPMenuField();

colMenu.HeaderText = "Address";

colMenu.TextFields = "url";

colMenu.MenuTemplateId = "PresenterListMenu";

colMenu.NavigateUrlFields = "url";

colMenu.NavigateUrlFormat = "{0}";

How to remove 'Delete Item' from context menu of a programmatically created list?

How to remove 'Delete Item' from context menu of a programmatically created list?
I have document library which is created programmatically but now I don't want to have 'Delete Item' in context menu of that document library. Are there any possibilites?

List Item menu button not lined up when scrolling

I have a custom master page and when I am viewing a list that requires me to scroll, the list item menu button doesn't display on the line I am currently hovering over. Instead it displays a few lines up, depending on how far I have scrolled. Any ideas on how to fix this?

menu item opens from below the menu and not to the right



when writing a menu in WPF, the menu acts differently between the main menu is pressed, and when one if it's dependencies when pressed.

on the first level, it opens the items from below the menuitem the was pressed.

in the second level it opens it from the right of the menuitem that was pressed.

i want that in all levels it will open the next submenu from the right of the menuitem that was pressed.

does anyone have an idea how ?

thanks !

How to assign shortcut keys for menu item of asp.net menu control

I am using asp.net menu control. In window application we assign shortcut key through '&' sign for accessing menu item but in asp.net this is not working and there is not any property for access key for menu items. please give me any suggestion.

Add menu item to a lists "general settings"


Hey all,

Is there a way I can add a link to an administrative page from within a lists settings page? For example if you go to a list and click "list settings" there is a header called General Settings, I would like to add a custom link in there if possible. I know how to do it for central administration for example, but I can't find the write settings to get it to show up on lists. Thanks for any help.

Grid view: menu item of hyperlink to view attachment excel and pdf

Good day,

i am facing a problem to create a hyperlink to view the attachment pdf and excel in table from a menu item i created.

below is my coding, themnuItem.NavigateUrl is wrong, i hope anyone can help me. i attach the printscreen of my table and the menu item, however i fail to make the hyperlink from the view image to my attachment.

i had a css file to create the menu item



            Dim models_select As String = Cmn.ReplaceDBNull(Me.gridView1.DataKeys(e.Row.RowIndex).Values("MODEL_SELECT"), "")
            Dim mnuAction As Menu = CType(e.Row.FindControl("mnuAction"), Menu)
            Dim mnuRoot As MenuItem
            Dim mnuItem As MenuItem
            'Dim CCLID As String = Cmn.ReplaceDBNull(Me.gridView1.DataKeys(e.Row.RowIndex).Values("CCLID"), "")

            ' Insert root item
            mnuRoot = New MenuItem()
            mnuRoot.Text = models_select & " "
            mnuRoot.NavigateUrl = ""
            mnuRoot.Selectable = False

Append an Item to a SP List and NewForm dropdown menu


When Lookup Column on a NewForm.aspx, that was populated from another SP List, does not contain a value in the DropDown menu can it be added/inserted into the source SP List from the NewForm without leaving the NewForm? 

Is there code or example how to insert the Item in the SP List, then refresh/repopulate the Lookup Column's DropDown menu (in the NewForm)?

Or is there a better way to do this add an item both the List and the dropdown without resetting the values already entered in the NewForm?


How to assign shortcut keys for menu item of asp.net menu control



I am using asp.net menu control. In window application we assign shortcut key through '&' sign for accessing menu item but in asp.net this is not working and there is not any property like access key for menu items. please give me any suggestion.



Nitin Munjani

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend