Is there an Ajax control available for this or would more a basic javascript
work just as well. I'm assuming I just need a div element that is shown on
a mouse over, but I'm not sure how to go about aligning all of the sub menu
items etc?

Advertisements

hi john,
i'm also interested in designing proper navigation for web sites with clean
markup. i don't like the built-in .net menu control because it generates
bloated markup.
although i haven't heard of the 'all-menu' before, i have implemented one
just like it recently. according to the all-menu description, it is fully
expanded all the time, i.e. static. in this case you would have no need for
ajax or javascript or dropdowns. my implementation below is static, pure
html, styled with css.
if you want to look at a sample, i have uploaded a test page to: http://tim.mackey.ie/stuff/Sample_Menu.html. if you view the source you'll
see that it generates nice markup, feel free to use the styles etc as you
see fit.

i based the implementation on sample code from http://www.asp.net/CSSAdapters/Menu.aspx, which shows how to create decent
HTML for a Menu control bound to a SiteMapDataSource. the example above is
dynamic/dropdown-based, but I wanted a static menu so i modified it. i
would recommend you follow the example mentioned above and get it integrated
into your site and working. i've included my modified version if you are
interested, you can just replace MenuAdapter.cs with the code below.
although it looks like a lot of code just to render a menu, it isn't really.
the internal code for the built-in asp.net menu control would look very
similar. it runs lightning fast for me anyway.

using System;
using System.Data;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Reflection;
using System.Web;
using System.Web.Configuration;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.Adapters;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.Adapters;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

private bool _disableAutoAccessKey = false; // used when dealing with
things like read-only textboxes that should not have access keys
public bool AutoAccessKey
{
get
{
// Individual controls can use the expando property called
AdapterEnabled
// as a way to turn on/off the heurisitic for automatically
setting the AccessKey
// attribute in the rendered HTML. The default is shown below
in the initialization
// of the bReturn variable.
// <asp:TreeView runat="server" AutoAccessKey="false" />

static public void WriteTargetAttribute(HtmlTextWriter writer, string
targetValue)
{
if ((writer != null) && (!String.IsNullOrEmpty(targetValue)))
{
// If the targetValue is _blank then we have an opportunity to
use attributes other than "target"
// which allows us to be compliant at the XHTML 1.1 Strict
level. Specifically, we can use a combination
// of "onclick" and "onkeypress" to achieve what we want to
achieve when we used to render
// target='blank'.
//
// If the targetValue is other than _blank then we fall back to
using the "target" attribute.
// This is a heuristic that can be refined over time.
if (targetValue.Equals("_blank",
StringComparison.OrdinalIgnoreCase))
{
string js = "window.open(this.href, '_blank', ''); return
false;";
writer.WriteAttribute("onclick", js);
writer.WriteAttribute("onkeypress", js);
}
else
{
writer.WriteAttribute("target", targetValue);
}
}
}
}

public class ControlRestorationInfo
{
private Control _ctrl = null;
public Control Control
{
get { return _ctrl; }
}

"John" <> wrote in message
news:...
> Hi there,
>
> I was reading an article
> (http://avenuea-razorfish.com/articles/TheAll-MenuNavigation_Turbek.pdf)
> on 'all-menu navigation' and I'd like to try and implement this in my
> site. Can anyone recommend how to get started?
>
> Is there an Ajax control available for this or would more a basic
> javascript work just as well. I'm assuming I just need a div element that
> is shown on a mouse over, but I'm not sure how to go about aligning all of
> the sub menu items etc?
>
> Please help a newbie!
>
> Best regards
>
> John
>

Share This Page

Welcome to The Coding Forums!

Welcome to the Coding Forums, the place to chat about anything related to programming and coding languages.

Please join our friendly community by clicking the button below - it only takes a few seconds and is totally free. You'll be able to ask questions about coding or chat with the community and help others.
Sign up now!