Get rid of PageMenu style="float:left;"

A place for discussion about skinning and design. Before posting questions here you should review the documentation about creating skins.

This thread is closed to new posts. You must sign in to post in the forums.
4/28/2011 9:52:45 AM
Gravatar
Total Posts 18409

Re: Get rid of PageMenu style="float:left;"

When I view the source of your page I see the style blocks for the menus at the top which means either UseNet35Mode is working or you are actually running under .NET 3.5.

If you are running under .NET 3.5 then there is no javascript adding the float:left and if you are running .NET 4 but UseNet35Mode is enabled it also has no javascript, so the float must actually be coming from CSS.

If you are hosted under .NET 3.5 with Medium Trust, see also the important notes about medium trust at the bottom of the Understanding the theme.skin file document.

Hope it helps,

Joe

4/28/2011 10:38:09 AM
Gravatar
Total Posts 73

Re: Get rid of PageMenu style="float:left;"

The content that belongs here is too complex to display securely.
4/28/2011 10:42:23 AM
Gravatar
Total Posts 18409

Re: Get rid of PageMenu style="float:left;"

 <portal:SiteMenu ID="SiteMenu1" runat="server" UseTreeView="false" UseArtisteer="true"
                        HideMenuOnSiteMap="false" Direction="Horizontal" TopLevelOnly="false"></portal:SiteMenu>

You still have UseArtisteer="true" which is why the new settings don't work, that makes it use the legacy artisteer menu.

4/28/2011 11:00:02 AM
Gravatar
Total Posts 73

Re: Get rid of PageMenu style="float:left;"

Just to clarify, as I posted before, when that was removed the menus don't render as menus at all, just ordered lists.  Since I'm a live site, I couldn't leave it that way and so added it back in.

4/28/2011 11:37:12 AM
Gravatar
Total Posts 18409

Re: Get rid of PageMenu style="float:left;"

That means either you don't have the right stuff in theme.skin or it is not noticing your changes to theme.skin. Editing theme.skin "should" clear the cache but I have seen times when it doesn't, you may need to touch Web.config after editing theme.skin to clear the theme cache.

Hope it helps,

Joe

4/28/2011 11:43:15 AM
Gravatar
Total Posts 73

Re: Get rid of PageMenu style="float:left;"

Thanks Joe, I appreciate the pointers.  At this point I'm going to let it ride with the direct css override as you suggested before.

Thanks again, both Joes.

4/28/2011 11:47:07 AM
Gravatar
Total Posts 18409

Re: Get rid of PageMenu style="float:left;"

one more thing I thought of, you need to copy theme.skin stuff from a skin exported from the same version of Artisteer as your design was exported from, because the menu/treeview container div css class is different in different versions and if you don't have the right one it won't work.

12/1/2011 9:53:04 AM
Gravatar
Total Posts 73

Re: Get rid of PageMenu style="float:left;"

I'm revisiting this thread after a long while.  Looking back on it, I sure seem thick.  Sorry for my newbishness.  I now have the ability to do offline development with WebMatrix, which is fantastic and makes these things so much easier to play with.  Thanks guys for your persistence and for supporting great development tools.

I started a new skin for another site using the latest artisteer30 skins in 2.3.7.0.  Artisteer 3 of course.

In the process, I went a bit deeper on making layout.master's tree structure match that of what Artisteer generates.  I got everything on this new skin looking great, but my old friend the pesky float was there, of course.

Looking back at your article on The Trouble With ASP.NET Menu, I saw the explanation for the additional classes is the Javascript associated with the menus.  I tooled around with this a bit and found a solution to disable that Javascript, so I figured I'd share it here. Fortunately, it's very simple.  See what you think.

The additional attributes on the menu markup, including the style: floats, comes from the ASP.NET AJAX scripts made specifically for the menu.  According to the articles I read, the script in question is fed to the page as "ScriptResource.axd", along with a set of query parameters tagged on the end to identify the desired script, since there's more than one.

Looking through the two ScriptResource.axd references served by the new design, I found the one that was manipulating the menu markup.  So far, so good.

I also ran across two articles on how to override these scripts through markup in the layout.master file.  They are here and here.  Apparently, the scripts are housed in .NET assemblies and pulled at run-time, so you can't change those scripts directly but you can instead specify that ASP should pull them as plain .js files from a path on your site.  Here's the additional markup:





The MenuStandards.js script does all of the manipulation.  To see it, you can either save the source of this script from the page before you update layout.master or you can download it from Microsoft's CDN at http://ajax.aspnetcdn.com/ajax/4.0/1/MenuStandards.js.  In fact, you can see a listing of all the scripts available from the CDN at http://www.asp.net/ajaxlibrary/CDNAjax4.ashx.

If you add the MenuStandards.js file in the same directory as layout.master and use the above scriptreference markup, you'll achieve the same effect with the page as the original, however it will be fetching MenuStandards.js from the filesystem and not from ScriptResources.axd, thus giving you control over what the script can do.

There would be two approaches, the surgical and the brute force.  The surgical method would be to cut out the pieces that you don't want from MenuStandards.js and leave the rest.

While this would probably be advisable when you aren't sure what functionality is supplied by the script aside from the annoying floats, I went with the brute force approach and it seems fine for me so far.  The brute force approach is of course to just empty out the file.  The menu renders as Artisteer intended now, at least with this skin.

For the record, I tried various methods of avoiding having to have a blank .js file by, for example, not including the path attribute in the scriptreference, but I couldn't find a way to make that approach work.

Hope this helps someone else as well.

One more thing, the technique on how I found the script name (and assembly) in the first place, since you can't divine that from ScriptResource.axd.  I found an article here which told me you can completely override all of the .NET scripts using a  scriptmanager attribute ScriptPath, which forces it to look for all such ScriptResource.axd scripts on the filesystem.  Doing this led to a combination of exceptions and 404s on the scripts the page was looking for, all given by their regular name and filesystem path.  The path happens to include the assembly name.  You can download each of the named files from the MS CDN (link above), create their path and put them in there to get past one exception to see the next.  Voila.

You must sign in to post in the forums. This thread is closed to new posts.