Web Forms :: Hide The Tags If An Asp:Menu Has No Data To Display?
Mar 9, 2010
I'm using asp:Menu (with the CSS friendly control adapters) for my sites navigation. I have everything displayed the way I want it and it looks great using CSS. However, when my sub category has no links, the asp:Menu is still adding the following HTML markup to the page:
[Code]....
The problem with that is my CSS style gives that a height of 25px. So when I have no navigation links available, my design shows a 25px gap under my main navigation before the content starts.
I thought I could try to solve this on my own but I haven't figured it out yet. There doesn't appear to be an option in asp:Menu to correct that behavior, so I started looking into adding a bit of code to my code behind file and then using Jquery to add a "visibility:hidden" to that <DIV> tag.In my code behind file (for the Master Page that displays the asp:Menu), this is what I'm trying to use:
[Code]....
I thought that would check the subMenu, and if there is no current node available, it would add the <SPAN> markup shown above.Then, on the MasterPage.master, I thought I could use the following Jquery:
[Code]....
I think the Jquery will work once I have the code in the code behind file working correctly. Not sure what I'm doing wrong though, or if I'm going about this the wrong way.
View 2 Replies
Similar Messages:
Feb 1, 2011
Is there a way to apply your own CSS tags to <li> tags when using ASP .NET 4.0 menu control? For example, say I have an external style sheet that has tags "class1", "class2", "class3", and etc. I want to apply "class1" to the first menu item. Then if menu item is selected, I want to apply "class2" and if it's not selected, "class3". I played with various 'Static' styles, but just can't get it work. I finally gave up and created my own menu control that extends ASP .NET menu control and provides my own custom rendering. This works, but I'm wondering if there is a way to get it work with built-in menu control.
View 1 Replies
Apr 8, 2013
What I want is to show menu items Administrator or show user menu items.Show menu items using login...How I can do it with role provider, control menu and siteMap in masterpage?
View 1 Replies
Mar 4, 2011
I am Trying to hide Navigation Menu Item on my master page based on a selected item from a Drop Down List on another page. I think i need to use a session to get the pages to communicate, which i can do just fine. Im having a problem putting together the code to actually Hide the link based on the specific answer of the DDL.
View 11 Replies
Jul 17, 2010
i have displayed a xml file in the tree view form by binding them....now i want a sample code to access the nodes which are being selected and to display dynamically in a grid view ..in asp.net/c#
View 4 Replies
Jul 28, 2010
I know that the code depicted below will not work but I am including it to convey the idea of what I wish to accomplish. I want to use a different SiteMap to construct the menu on the displayed page for each of three different classes of service (COS).
I set a session variable named "COS" at the login and want to test its value prior to rendering each page. I want to display a menu based upon the appropriate COS. Here is my first stab at it but I know that I cannot include <asp:...> controls within the "case" statements. Can anyone suggest methods of doing this? I know C# and can use that but I do not know how to select the proper sitemap within the <menu> control. I am also using a CSS in my production version.
[Code]....
View 2 Replies
Feb 10, 2011
today i've seen that in google, the preview of one of my sites it's showing the asp.net-4.0-menu-flow-layout as a list, so the preview is very ugly.
What's the best approach to resolve this little problem and page-loading same issue?
I've to hide menu div by javascript (but when i've to show it?
View 4 Replies
May 11, 2010
How can I hide some items in my menu if you are just a user & only appears if you log in as administrator? I would like to hide the siteadmin. Below is the code:
[Code]....
View 7 Replies
May 23, 2010
I have an application where I am trying to gain as much screen area as possible. Given the following asp:menu from the Site.master can I somehow show/hide it?
[Code]....
View 4 Replies
Nov 12, 2010
I do not want to show the instanceID field in my Gridview, however I need these values for each row in the final HTML so that I can use Javascript later on to lookup up for a specific instanceID in the whole document. Any way of doing that?
my code:
[Code]....
View 2 Replies
Nov 12, 2010
I have the following Menu control:
[Code]....
How do I hide the root node and some other nodes if I do not want it to show on the navigation menu?
View 15 Replies
Jan 7, 2011
I am using the standard template for web form with login and menu..
I would like to disable the menu when u enter the page (done this by visable = false). but after a user have logged in, i want it to be shown..
How do i get a hold on the navigation menu when a user login?
View 7 Replies
Feb 5, 2011
How can i have a menu control that Manage SiteMapNode from the menu to hide and Just when admin logged to see it.
[Code]....
View 1 Replies
Jul 23, 2013
I have menu item on which come from website map. I have trimmed the main item of menu based on user roles.
Like i have one menu in which i have 5 reports i want to show 2 reports to agents and 5 reports to admin. how to apply roles on sub menu item.
View 1 Replies
Oct 15, 2010
in my web page gridview is there
how to select row with out using select command ,how i can select row and right click event
in right click event context menu display is there possible using server side coding r we can use client side programming
View 3 Replies
Jan 8, 2011
My issue is,i have two tables
Table Maincategory:
Id(p.k)
Category name,
Description
Table Subcategory:
Id(f.k)
SubcatID
Subcatname
Desc
My issue is, i need to display my Table(A) categoryname in my vertical menu such as
ashok
kumar
suresh
john.
if i click ashok, with respect to its id,(say id is (1),it should pick the subcategoryname (2nd table's) name corresponding id(1) from 2nd table...and it should display as sub menu is it possible.
View 2 Replies
Oct 2, 2010
I am using wicked code sqlsitemapprovider and it's VB version. Most of the things are going OK! But when I wanted to hide some of the nodes from appearing on menu while staying shown on sitemappath I cannot figure it out. I tried to change the sqlsitemapprovider code but was unsuccessfull.
[Code]....
and I get this error:
Özel Durum Ayrıntıları: System.IndexOutOfRangeException:
visibleKaynak Hatası:
[Code]....
Kaynak Dosya: D:WebsiteskaihlApp_CodeSqlSiteMapProvider.vb Satır:
156
How can I add this functionality into this system.
View 4 Replies
Dec 30, 2010
I am using the default menu bar in visual web developer 2010.I have a Staff Portal item, this has child nodes such as sales, marketing that i would like to keep hidden until the user logs in.I'm using vb.net if that comes into it
View 5 Replies
Jul 11, 2010
How to display HTML Tags in my asp.net page?
Example: I need to load the following text from DB and display it in my page.
<p> </p> <h1 style="text-align: center"><span style="background-color: yellow">Hello World</span></h1>
I have assigned it to a placeholder but it display as is not as tags.
View 8 Replies
Jan 24, 2011
I have a aspx page with 3 contentplaceholders.
In contentplaceholder1, i have a menu with submenu items.
I need a functionality by which whenever i hover on any menu item or select any item it should display repective content in the contentplaceholder2
View 8 Replies
Jul 13, 2010
I hv created menu using sitemap xmldatasource now i want to display that based on Category or Roles. I have Created 4 Category in my sql Server 2005. when particular user logged in based on his Category menu nodes should display.
View 7 Replies
Aug 12, 2013
I have written code for menu with web.sitemap and SiteMapDataSource1.I want to hide the admin panel if user has no admin rights.
How there is relation between sitemapdatasource,web.sitemap and menu.
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" ShowStartingNode="false" />
<asp:Menu ID="Menu" runat="server" DataSourceID="SiteMapDataSource1" Orientation="Horizontal"
OnMenuItemDataBound="OnMenuItemDataBound" onmenuitemclick="Menu_MenuItemClick" Width="100%">
<LevelMenuItemStyles>
<asp:MenuItemStyle CssClass="main_menu" />
[Code] .....
View 1 Replies
Apr 24, 2015
I have placed an aspx menu control on my master page with orientation as Horizontal. Below is HTML markup.
HTML Code:
<asp:Menu ID="mnuMedChem" runat="server" Orientation="Horizontal" Width="100%" OnMenuItemClick="mnuMedChem_MenuItemClick">
<DynamicHoverStyle CssClass="DynamicHover" />
<DynamicMenuItemStyle CssClass="DynamicMenuItem" />
[Code]....
I have tried populating the menus from my database by using the
Code:
mnuMedChem.Items.Add
and
Code:
mnuMedChem.FindControl(value).ChildItems.Add
The menu items and the childs are populating correctly but then the menu is not being displayed on the menu control.
View 4 Replies
Aug 31, 2010
I have dropdown menu item ("pin this site") that i need to hide it or hide menu item itself ("My Network").
When I saw viewsource on page, I got below code.
<a class="zz1_TopNavigationMenu_1 ms-topnav zz1_TopNavigationMenu_3
ms-topnavselected zz1_TopNavigationMenu_9" href="http://mynetworkqa.spe.org"
style="border-style:none;font-size:1em;">My Network</a>
<a class="zz1_TopNavigationMenu_1 ms-topNavFlyOuts zz1_TopNavigationMenu_6"
href="javascript:__doPostBack(,
'ctl00$PlaceHolderTopNavBar$PlaceHolderHorizontalNav$topSiteMap''Pin')"
style="border-style:none;font-size:1em;">Pin this site</a>
How can I hide menu item?
View 1 Replies
Jun 29, 2010
I want to display a menu on LHS which display Category and an arrow. When one clicks on arrow Products corresponding to that Category are displayed. How can one do that?
Menu: Category1(Arrow Image)
Product1
Product2
Category2(Arrow Image)
Category3(Arrow Image)
View 4 Replies