CSS Friendly + asp:menu control RRS feed

  • Question

  • User-2026628175 posted

    Hi there, basically im having some problems with the annoying generated styles that .net puts in when using controls with the css friendly component. It seems to auto generate a load of css styles and put them in a webresource.axd file. the content of these is playing havoc with my css.

    I dont really want it to generate any css for me, i cant write it myself, but ill be damned if i can find where it is disabled!

    Anyone able to tell me how i can strip out all of the formatting .net puts into the menu?



    Wednesday, June 10, 2009 6:41 PM

All replies

  • User1152736709 posted

    If you are using the CSS Friendly Adapters than you should have the CSSFriendlyAdapters.browser file present in the App_Browsers directory.

    Open this file and comment out the following line to disable the CSS Friendly Adapters for the ASP.NET Menu control.

    <adapter controlType="System.Web.UI.WebControls.Menu"
        adapterType="CSSFriendly.MenuAdapter" />
    Using this file you can choose to which controls the CSS Friendly Adapters are applied.
    Thursday, June 11, 2009 2:03 AM
  • User-2026628175 posted

    Thanks for the reply, but that is not really the behavior i am after. I still want the html layed out css-style (with UL and LI's instead of dirty tables) i just dont want all the css stylesheet markup auto generating, any ideas?



    Thursday, June 11, 2009 2:56 AM
  • User-2026628175 posted

    Is there a way to do this without having to recompile the CSS friendly component? i can't actually do this as my visual studio does not allow me to load C# projects for some reason, and there is no VB version that i could find..

    Thursday, June 11, 2009 12:48 PM
  • User-2026628175 posted

    Could somone please tell me how i get rid of these annoying auto generated styles? .net is putting a "height:1% !important;" on A tags inside my menu, this totally messes up IE6 compatibility and i cant seem to get rid of it!

    This has sadly halted my progress with the site for several hours now, what a waste for such a silly problem :(


    Thursday, June 11, 2009 6:34 PM
  • User-2026628175 posted


    Anymore ideas on this? i am still banging my head against a brick wall trying to get my page to display in IE6!



    Monday, June 15, 2009 6:37 AM
  • User1660405101 posted

    Radion, what version are you using? I'm running into the same problem with IE6 and menus, even after I overrode all the built-in styling with my own (verified with firebug). I'm on build 24242. I was under the impression 1.0 could give you pure css-friendly html without built-in styling?

    From what i see in the code, for 24242 anyway, it looks like it'll take a rebuild. Actually, after i thought about it some more, it looks like if you apply your own !important property to all your own css, taking care to override everything the built in css does, you should be able to style it exactly as you want. It worked for me.

    I've got to say, I kind of disagree with the bundling of the CSS. I apologize if I'm making some short-sighted assumptions since I've only given the project a cursory glance, but it seems like it would be more powerful and flexible to keep the CSS in a separate file that users can use, rather than integrating it into a built-in axd resource. From a styling point of view, if I'm building something from the ground up, I'd rather have blank, css-friendly html, rather than something pre-styled.

    Monday, August 24, 2009 4:56 PM
  • User-1083514466 posted

    If you want to drop out the included CSS and javascript you will have to edit the adapter classes and recompile. Or, if you're just using the menu adapter, you could just drop the MenuAdapter.cs and WebControlAdapterExtender.cs files into your App_Code folder. From there you can just modify the MenuAdapter to not register the scripts. I had to do some modifications to change/add some CSS class names as well.

    Also, if you're looking for some nice CSS and javascript to replace the built in stuff, Superfish is working great for me. I'm not that great with CSS and the Superfish styles were much easier for me to modify than the CSSFriendly styles were.

    Thursday, August 27, 2009 12:22 PM
  • User-451494334 posted

    This is certainly a pain to have to fight the styles compiled into the dll. I solved this problem very quickly as follows.




    1. Downloaded the Zip file.
    2. Extrac the zip file
    3. Open solution file CSSFriendly.sln (VS 2008, C#)
    4. Expand the CSSFriendly project
    5. Expand the Css Folder
    6. Edited the conflicing css values in the Menu.css file
    7. Build
    8. Copy the Dll from your build location to the bin of the project where you are creating the menu.
      1. EG: (..\CSS Friendly Adaptor\CSSFriendly_1.0\CSSFriendly\bin\Release)
    9. Started the site and my Css change now applies to the webresource.acx 

    The bottom line is that the css is compiled into the dll. This is a mistake if you ask me. Its hard to get your menu to position itself exactly as intenede if you have to fight existing css. Some basic Css is required so the rendered html acts like a menu, but I think it could be trimed down a bit. This is the reason why the give us the whole project. Its really fast and easy once you figure it out.


    Hope this helps someone.

    Monday, February 1, 2010 8:08 PM