L
Leslie
I have a customer that is very concerned with having all web sites present
standards compliant html. When using the Menu control I have found a couple
of problems regarding the width and the valign attributes.
When I specify a StaticMenuStyle.Width of 188 the resulting html is
generated with two width attributes as in:
<table border="0" cellpadding="0" cellspacing="0" width="100%" width="188">
When I build a menu item that references an ImageUrl the resulting html is
generated with the valign attribute as in:
<img src="spacer.gif" alt="" valign="middle" />
My understanding is that the valign attribute is not valid for the img
element.
Is there a way I can remove these two problem cases via my code or is it
something that cannot be fixed for now? I am using Visual Studio 2005 with
the .NETFramework 2.0.
The source page used to generate these problems is included below.
Thanks,
Leslie
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
MenuItem miHeader = null;
MenuItem mi;
mi = new MenuItem("", "", "spacer.gif", "");
mi.Selectable = false;
mnuSpacer.Visible = true;
mnuSpacer.Items.Add(mi);
mi = new MenuItem("First Section", "", "", "");
mi.Selectable = false;
miHeader = mi;
mnuLinks.Visible = true;
mnuLinks.Items.Add(mi);
mi = new MenuItem("Microsoft", "", "", "http://www.microsoft.com");
mi.Selectable = true;
miHeader.ChildItems.Add(mi);
mnuLinks.StaticDisplayLevels = 2;
} // protected void Page_Load(object sender, EventArgs e)
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:menu id="mnuSpacer" runat="server">
</asp:menu>
<br />
<br />
<asp:menu id="mnuLinks" runat="server">
<staticmenustyle width="188px" />
</asp:menu>
</div>
</form>
</body>
</html>
standards compliant html. When using the Menu control I have found a couple
of problems regarding the width and the valign attributes.
When I specify a StaticMenuStyle.Width of 188 the resulting html is
generated with two width attributes as in:
<table border="0" cellpadding="0" cellspacing="0" width="100%" width="188">
When I build a menu item that references an ImageUrl the resulting html is
generated with the valign attribute as in:
<img src="spacer.gif" alt="" valign="middle" />
My understanding is that the valign attribute is not valid for the img
element.
Is there a way I can remove these two problem cases via my code or is it
something that cannot be fixed for now? I am using Visual Studio 2005 with
the .NETFramework 2.0.
The source page used to generate these problems is included below.
Thanks,
Leslie
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
MenuItem miHeader = null;
MenuItem mi;
mi = new MenuItem("", "", "spacer.gif", "");
mi.Selectable = false;
mnuSpacer.Visible = true;
mnuSpacer.Items.Add(mi);
mi = new MenuItem("First Section", "", "", "");
mi.Selectable = false;
miHeader = mi;
mnuLinks.Visible = true;
mnuLinks.Items.Add(mi);
mi = new MenuItem("Microsoft", "", "", "http://www.microsoft.com");
mi.Selectable = true;
miHeader.ChildItems.Add(mi);
mnuLinks.StaticDisplayLevels = 2;
} // protected void Page_Load(object sender, EventArgs e)
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:menu id="mnuSpacer" runat="server">
</asp:menu>
<br />
<br />
<asp:menu id="mnuLinks" runat="server">
<staticmenustyle width="188px" />
</asp:menu>
</div>
</form>
</body>
</html>