.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

how to show subitem of the menu on only clicking the parent menu not on mouse over

Posted By:      Posted Date: September 28, 2010    Points: 0   Category :Windows Application

hi i want that when i take the mouse over the menu i dont want to show submenu.the submenu should only be display on clicking the parent item . i have writen code as 

 <asp:Menu ID="Menu1" runat="server" BackColor="#FFFBD6" DynamicHorizontalOffset="2" 

            Font-Names="Verdana" Font-Size="0.8em" ForeColor="#990000" Orientation="Horizontal" StaticSubMenuIndent="10px" Style="z-index: 112; left: 205px;

            position: absolute; top: 14px">

            <StaticMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />

            <DynamicHoverStyle BackColor="#990000" ForeColor="White" />

            <DynamicMenuStyle BackColor="#FFFBD6" />

            <StaticSelectedStyle BackColor="#FFCC66" />

            <DynamicSelectedStyle BackColor="#FFCC66" />

            <DynamicMenuItemStyle HorizontalPadd

View Complete Post

More Related Resource Links

Can't get an Icon to show for Desktop shortcut and Program Menu



I've created a SetupWizard, but can't get it to show the Icon for the shortcut on desktop and program menu. The installation goes fine without any errors, the only problem is the icon.

I've made a shortcut of my exe file in the Application Folder and dragged the shortcut to the Desktop folder, then on the shortcut properties, I assigned it an icon picture located in Application Folder.

Any suggestions will be very much appreciated.


Modify Menu adapter to show selected


Hey, I need some help modifying the menu adapter code to give child <ul> elements a class value indicating that the parent is selected. It should render like this:


< ul class="AspNet-Menu">
	< li class="AspNet-Menu-WithChildren  AspNet-Menu-ChildSelected">
		< a href="/rockit/admin/Default.aspx" class="AspNet-Menu-Link  AspNet-Menu-ChildSelected">
		< span>Mypage< /span>< /a>
			< ul class="AspNet-Sub AspNet-Sub-Selected">
				< li class="AspNet-Menu-Leaf  AspNet-Menu-Selected">
					< a href="/rockit/admin/Default2.aspx" class="AspNet-Menu-Link  AspNet-Menu-Selected">
					< span>Test< /span>< /a>
				< /li>
				< li class="AspNet-Menu-Leaf">
					< a href="/rockit/Default3.aspx" class="AspN

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

Context Menu And Mouse Click Issue

Hello. I am trying to show a context menu at runtime on MouseRightButtonUp, while over a selected image. I also have left mouse button events set up for the selected image. For some reason I cannot get the context menu to show unless I click the left mouse button and while it is held down click the right mouse button and keep it down while I release the left mouse button, followed by releasing the right mouse button. I tested the MouseRightButtonUp event using a simple MessageBox and did not have any problems; it worked as expected when the right mouse button was released. Here is the code: //add behavior for right mouse on this image. img.MouseRightButtonUp += (sender, e) => { //Create Context Menu ContextMenu menu = new ContextMenu(); //img is an Image img.ContextMenu = menu; //Add context menu item MenuItem photoNewWindow = new MenuItem(); photoNewWindow.Header = "Open Original Image"; photoNewWindow.Click += OpenOriginal; //Add menu items to context menu menu.Items.Add(photoNewWindow); //change the current image currentImage = img; }; // add behavior for mouse click on this image. img.MouseLeftButtonUp += (sender, e) => { // left mouse stuff }; Thanks! 

Can not show image in Filter drop down menu in SPGridView - Sharepoint 2007

Hi, I can not show image in the filter drop down menu (at header) of SPGridView in Sharepoint 2007.  For example: I have 3 rows as "_layout/images/1.gif", "_layout/images/2.gif", "_layout/images/3.gif". When user click on the column's header, the SPGridView just displayed filter menu and it always displayed the text (_layout/images/1.gif) not an image as I expected. So please help me to solve this problem. Thanks a lot Dan

How to show left menu and center of page contents in an ASPX page?


Scenario : Within sharepoint site user will click on a hyperlink which should take him to a new page and this new page will have the same header/footer (so I will create a copy of the masterpage with just header,footer) but the left side menu navigation will dynamically change and for each click event within the menu, the center of the page will show varying texts plus videos.

Need some directions as how I can acheive the above? What should I use to build menu control and similarly how to control the center text of the page.  

Can I acheive the entire above using webpart and if so how? Do I need to use user control for menu and for center text display webpart ? or else any other best options?  

Please suggest.

How do I get a custom context menu to show up???

Okay, I just started back working on my web browser using Visual Basic 2K8, and I want to have my custom context menu show up when the user clicks inside the browser..... This is what I have...
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim Browser As New WebBrowser
        TabControl1.TabPages.Add("New Tab")
        Browser.Name = "Web Browser"
        Browser.Dock = DockStyle.Fill
        AddHandler Browser.ProgressChanged, AddressOf Loading
        AddHandler Browser.DocumentCompleted, AddressOf Done
        Int = Int + 1
        CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).Navigate(UrlLocation.Text)
    End Sub

That is where I suspect the bit of code will have to go... Since I'm using Tab Control instead of the WebBrowser...

Tabs on CSS Friendly ASP:Menu not reacting properly to mouse over


I have created a horizontal main menu that exploits Douglas Bowman's 'Sliding Doors' technique to create variable width tabs, as modified by Christophe Geers for application to the ASP:Menu control (using the CSS Friendly Control Adapters). The menu is also horizontally centred using techniques described by Matthew James Taylor. My markup and CSS is shown below.

Among other differences, the selected tab is taller than the others, and the text colour changes to black instead of blue. If you move the mouse over the middle of an unselected tab, then this tab also rises up and the text colour changes to black. It is also clickable. That is the desired behaviour.

My problem is that unselected tabs are not fully sensitive to a mouseover across their full width.

This problem happens when the mouse is moved over the left edge of an unselected tab (within 4 px of the edge, this being the width of the left hand tab graphic). The tab moves up as expected but the text on the tab remains blue and the tab is not clickable. This behaviour occurs with all tabs when in the unselected state and is the same in both IE8 and Safari 4.0.2.

Are there any CSS gurus out there who can suggest a fix?




how to show site action menu on custom master page??


i have created my own custom master page and trying to show "site action" menu on my master page

how is this posible,what modifications are needed in .master file  to do this

 in sharepoint 2010


problem in asp:menu font after clicking the button...


i've got this problem in asp:menu once i click a submit button the asp:menu font is change... also the drop menu got a space... how can i solve this problem any help???

im using c# .net

Adding New Custom Folder Content Type doesn't show up on the Document Library New Menu


I been trying to add new custom folder content type to the document library programatically in my sandbox environment and it does show up on the document library. But, when I move same code to the almost similar configured SP2010 environment, adding new folder content type to the document library doesn't show up on the document library's new menu.

Here is the code? Since this code works fine in my sandbox environment, is there any other settings I should check on the server environment which would cause hiding content type on new menu of document library.

  class Program
    static void Main(string[] args)
      SPSite spSite = new SPSite("http://sp2010vm");
      foreach (SPWeb spWeb in spSite.AllWebs)
        spWeb.AllowUnsafeUpdates = true;

        //For each site, cycle through lists
        bool isDocLibraryExists = false;
	      foreach(SPList spList in spWeb.Lists)
          if(spList.Title == "Classified Documents")
             isDocLibraryExists = true; 
        if(isDocLibraryExists == true)
          //Create new doc library
          SPList splist = spWeb.Lists["Classified Documents"];

          //Create Content Type
          SPContentType documentContentType = spWeb.AvailableContentTypes["Classified Documents Folder"

Null values doesnot show up in custom edit form in a drop down choice menu


Hello guys,

I have a problem. I don't know why custom edit form is behaving like that.

I have a choice drop down with values  " ","Yes","No". For custom  new form, I can insert null values and everything is working fine.

But coming to this custom edit form which I created.  While editing, if we set a value to null and submit the form. It is getting the "Yes" as the value. It is skipping the null value and placing the "Yes" value. I have kept the default value for choice drop down as " ".(null too).

I don't know why it is not showing null value. Do guys have any idea or if came across anything like this. Please help

Creating Menu Dynamically and Show form dynamically in Windows Forms


Dear All,

I am using a splitter control in windows forms. Left panel is having menus which I have populated from Database. And Right panel should display forms according to the selection from left pan.

For Eg. I  have a Main menu called Forms and got 5 Sub menus names  form1,form2,form3,form4 and form5 .When I click Form1 in Menustrip it should display Form1 on the right panel . And the same goes for all the menus.

Can you somebody guide me how can I achieve that

Best Regards


Ajax Accordion panel parent child child menu creation



Hi, I am trying to set up a Ajax Accordion Dynamic menu from the database. Functionality must be as follows:  I have Parent with a child and child with other child    can any one help me in this .

. Thanks in advance

ASP.NET Menu with jQuery Superfish

Choosing the right type of menu for a website is not easy at all. The ASP.NET Menu Control is definitely NOT a good starting point due to the horrendous markup it renders, nor is it good for SEO because of the Markup/Content ratio, neither can it be easily styled.

Problem making Role based Menu in MVC application



 I want to make Rolebase menu in MVC such that if user doesnot have permission for some action then that Action name shouldnot be shown in the Menu.

 I have used the code in the url(http://forums.asp.net/t/1566328.aspx) in my MVC application.My application is a Discussion Forum(in MVC) same functionality as in this forum forums.asp.net

 I have used Controllers for post, thread etc.In each controller there are some actions that are using [Authorize(Roles)] attribute

 but this coding does not count  those Actions in Controllers having Authorize attribute according to the url http://forums.asp.net/t/1566328.aspx 

 In the code, Authorize attribute is applied to Controller class, but my requirement is of Applying Authorize attribute to some actions in controller so that some are available for all users and  some links are available rolewise.Now what is the solution for that?



DropDownExtender - menu disapears


Hello all, first ever post here :)

Hope you guys can help me out, this drives me crazy...

So I got 2 updatepanels on my page. In one there is a Timer which updates for example a label. In the other one there is a dropdownextender. Everytime the timer ticks while the dropdown menu is displayed the menu disapears. I attached the sample code below....any insights on this? And yes, the dropdown and the label need to be in two seperate updatepanels....

Many thanks



<form id="form1" runat="server">

<asp:ToolkitScriptManager ID="ScriptManager1" runat="server" />

<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<asp:Timer ID="Timer1" runat="server" OnTick="Timer1_Tick" Interval="4000" />
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>

<asp:UpdatePanel ID="UpdatePanel2" runat="server">

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