CodeVerge.Net Beta


   Explore    Item Entry    Members      Register  Login  
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML

Free Download:




Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.master_pages_themes_and_navigation_controls Tags:
Item Type: NewsGroup Date Entered: 12/3/2005 1:16:17 AM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 10 Views: 37 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
11 Items, 1 Pages 1 |< << Go >> >|
MorningZ
Asp.Net User
Strange CSS output with <asp:menu>12/3/2005 1:16:17 AM

0/0

I've got this in my master page

<asp:Menu ID="MainNav" runat="server"   

DataSourceID="DefaultSiteMapDataSource"
     
orientation="Horizontal"

      maximumdynamicdisplaylevels="0"

      skiplinktext=""

      staticdisplaylevels="2" PathSeparator=" | "

      ForeColor="#ffffff" />

 

and this in my CSS

.MainNav {
   
 text-transform: uppercase
;
   
font-size: 10px
;
}

yet, looking at the generated HTML, this is what its generating out

<td style="white-space:nowrap;"><a class="Master_MainNav_1" href="/Default.aspx">Home</a></td>

 

meaning that the hyperlink is not picking up the assigned styles

any ideas?


"If you make it idiot proof, they'll build a better idiot"
Blake05
Asp.Net User
Re: Strange CSS output with <asp:menu>12/3/2005 1:36:44 AM

0/0

There should be a feild where you can put your styles, in the property portion of the control And just select the style needed.

Blake

-Blake Niemyjski
Blog - Website: windowscoding.com
MorningZ
Asp.Net User
Re: Strange CSS output with <asp:menu>12/3/2005 2:15:38 AM

0/0

i need to keep it to CSS so it adjusts gracefully with just Themes

this exact code has worked on other sites and theres no reason why CssClass="MainNav" should generate as class="Master_MainNav_1" like it is (btw, i set the ID of my master to "Master"


"If you make it idiot proof, they'll build a better idiot"
dannychen
Asp.Net User
Re: Strange CSS output with <asp:menu>12/3/2005 9:48:05 PM

0/0

It appears that you don't have a CssClass set on your Menu declaration.  In order to apply your own CssClasses, you should use the CssClass property on the Menu as a previous poster said.

The class that you are seeing appears to be the default name of the styles that the menu emits.  Typically the naming convention will be something like:  controlsClientId_[0-n].  So you'll see something like:  .Menu1_0, .Menu1_1, .Menu1_2, etc.  With the control in naming containers like Panel1_Menu1_0 or similar.   

--

Danny


disclaimer: Information provided is 'as is' and conveys no warranties or guarantees.
MorningZ
Asp.Net User
Re: Strange CSS output with <asp:menu>12/4/2005 4:29:39 PM

0/0

I swear i had that set at one point!! :)

Anyways, so so more of an attempt to fix this issue, now i have

<asp:Menu ID="MainNav" runat="server"
         
CssClass="MainNav"
         
DataSourceID="DefaultSiteMapDataSource"
         
orientation="Horizontal"
         
maximumdynamicdisplaylevels="0" 
         
skiplinktext="" 
          staticdisplaylevels="2" PathSeparator=" | "
         
ForeColor="#ffffff" />


Checking in the "DataBoundEvent"


Protected Sub MainNav_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles MainNav.DataBound
      HttpContext.Current.Trace.Warn(
"Class: " & MainNav.CssClass)
End Sub


tells me this in the trace log


Class: MainNav


Now checking the generated HTML:

<table id="Master_MainNav" class="MainNav Master_MainNav_2" cellpadding="0" cellspacing="0" border="0">


"MainNav Master_MainNav_2" ???  Absolutely perplexing :(


"If you make it idiot proof, they'll build a better idiot"
dannychen
Asp.Net User
Re: Strange CSS output with <asp:menu>12/5/2005 9:37:14 PM

0/0

MorningZ wrote:

Now checking the generated HTML:

<table id="Master_MainNav" class="MainNav Master_MainNav_2" cellpadding="0" cellspacing="0" border="0">


"MainNav Master_MainNav_2" ???  Absolutely perplexing :(

This means that two CSS classes are being applied to the table:  MainNav AND Master_MainNav_2.  MainNav is the class that you applied through the property.  Master_MainNav_2 is the one that comes from the Menu control.  If you look at the style block on the page, you should see a set of styles called: 

.Master_MainNav_1
.Master_MainNav_2
.Master_MainNav_3
etc...

There is no way to avoid these, these styles are necessary for the menu to function correctly.  One of the functions, for example, is to hide the dynamic flyouts by default.  If you try and alter the appearance through the styles (such as StaticHoverStyle-BackColor) you would see it appear in one of these default styles. 

Hope that helps you decipher your output.
--
Danny


disclaimer: Information provided is 'as is' and conveys no warranties or guarantees.
MorningZ
Asp.Net User
Re: Strange CSS output with <asp:menu>12/5/2005 10:02:58 PM

0/0

ok, so what i am confused about:

What you appear to be saying is that there is no way to set the menu item's styles from a .css file because the framework will always and no matter what put theNav _1 class there as well?

that kinda sucks :(


"If you make it idiot proof, they'll build a better idiot"
MorningZ
Asp.Net User
Re: Strange CSS output with <asp:menu>12/5/2005 10:30:11 PM

0/0

Danny, of course you could have pointed me to this post on your blog, lol

i don't know why just now it came up through my RSS reader, but good stuff in there and looks like it'll help me both understand whats going on under the hood and solve my problem.....


"If you make it idiot proof, they'll build a better idiot"
dannychen
Asp.Net User
Re: Strange CSS output with <asp:menu>12/6/2005 12:31:10 AM

0/0

MorningZ wrote:

ok, so what i am confused about:

What you appear to be saying is that there is no way to set the menu item's styles from a .css file because the framework will always and no matter what put theNav _1 class there as well?

that kinda sucks :(

That's not quite what I'm saying: 

What I mean to say is that there is no way to get around a minimal set of styles that we put into the Menu.  They are there to make the menu functional correct but we've done as little as possible to intefere with your ability to customize it's look and feel.

Users are still able to add their own styles from a .css file and they will get applied to the rendering where appropriate.  For example:

.a { background-color: blue; }
.b { z-index: 10; }

<table class="a b" >...</table> 

In this case, both classes a AND b get applied, not just b.  The table has a z-index of 10 and a background color of blue.  This is what is happening in your output.  Two clases (or more) are being applied to the various elements in the menu's rendering.  All of them get applied (although conflicts sometimes do arise and get resolved by IE/FF/etc). 

I think you might find it much clearer if you change the CssClass and the ID to be different names.  Your CssClass and the built in one will be much more distinct.

Although, perhaps I am missing something about what you're asking.
--
Danny


disclaimer: Information provided is 'as is' and conveys no warranties or guarantees.
RTernier
Asp.Net User
Re: Strange CSS output with <asp:menu>12/6/2005 5:28:29 AM

0/0

MorningZ wrote:


<asp:Menu ID="MainNav" runat="server"   

DataSourceID="DefaultSiteMapDataSource"
     
orientation="Horizontal"

      maximumdynamicdisplaylevels="0"

      skiplinktext=""

      staticdisplaylevels="2" PathSeparator=" | "

      ForeColor="#ffffff" />

 

MainNav {
   
 text-transform: uppercase
;
   
font-size: 10px
;
}



Your error is your trying to reference an ID (object) through a CSS class declaration.

Make the CssClass="MainNav" in the Menu object and it will work properly... unless you just made a typo.

If you want to have an ID reference a CSS Style it must be:

<div id="divContent">....</div>

CSS:

#divContent
{
  margin: 0 auto;
  width: 500px;
...
}

The Killer Ninja Coding Monkeys thank those that mark helpful posts as answers.

My Site | My Examples | My Blog
MorningZ
Asp.Net User
Re: Strange CSS output with <asp:menu>12/6/2005 10:52:23 AM

0/0

RTernier wrote:
Your error is your trying to reference an ID (object) through a CSS class declaration.


no, i was using classes, not id's, your copying of my code above hacked off the leading period for some reason (look at my very first post again)


"If you make it idiot proof, they'll build a better idiot"
11 Items, 1 Pages 1 |< << Go >> >|


Free Download:


Web:
ASP.NET 2.0 menu renders invalid html/css ASP.NET 2.0 menu renders invalid html/css. I have a quite strange problem with the Menu control. I have ten languages and each language has ...
CSS Adapter for ASP.Wizard Control Jump Menu. Navigation; Content; Search ..... re: CSS Adapter for ASP.Wizard Control. Gravatar @Todd - strange. The only thing I can suggest is that you ...
Problem with DynamicItemTemplate in CSS Friendly Menu - ASP.NET Forums and binding it to my ASP:Menu. (For reasons I won't get into here, .... Render( HtmlTextWriter output) +68 System.Web.UI.Control. ...
Extending ASP.NET 2.0 Menu Control To Have Tabs With Rounded Corners Creating a CSS friendly Menu Control is a matter of inheriting the ASP Menu ... an Adapter for the Menu control that generated CSS Friendly html output. ...
Coding Instinct: Breadcrumb menu using JQuery and ASP.NET MVC The span with the dropdown css class is the arrow element that you click on to show the dropdown menu. So what is the strange ajaxUrl that is embedded in ...
Michael O'Donovan's SharePoint and Stuff : Custom Navigation in ... Besides the HTML output control, I have also had scenarios like "the ... Here you provide CSS styles for the SharePoint ASP menu control, the ASP . ...
Tomblog » CSS (You can specify a CSS class for the ASP.NET menu to use) A possible resolution would be ... When investigating the thing, I discovered this in the output. ...
Strange CSS action: Possible causes? - HTML and CSS Strange CSS action: Possible causes? Aug 6th, 2007. I've been working with a css file to produce a few bits of needful output formatting for ...
Shane Perran’s SharePoint Customization Blog » ASP.NET 2.0 Today we published the CSS Control Adapter Toolkit for ASP. ... how you can use the control adapter architecture to emit 100% CSS based rendering output (no ...
ASP.NET Development Nov 5, 2005 ... Hi, I am trying to use the menu control to create a menu similar to the one that ASP.net site has and I am having a little trouble. ...




Search This Site:










customize module settings interface and parametries

how to create: "automatically sign in for the next time"

if i want to be compatible, shoudl i bother with these?

help with asp/adsi/ldap code to asp.net

page reloading

showing only the time part of a datetime field in a gridview

dynamic custom control

reg:application blocks

dnn3.0.10 bug: deleting super user kills host module

syntax for adding to the current context question

dropdown list should fire aspx page, how? help please???

displaying powerpoint

how to make site ssl only

inserting " and ' in javascript bits

array vs arr()

dnn 3.0.8 install - no host or admin menus

date error

.net 2003 - .net 2005 beta produces different result for same code.

no question too simple?

detailsview not appearing during debug

3.0 upgrade woes with security - cannot logon, user emails gone...

excel references

installer for web site & win service

starter kit woes

dropdown list question!

treeview style question

using css in asp.net

pass value to function

roles and web layout

authorization deny/allow doesn't work after deployment

 
All Times Are GMT