473,499 Members | 1,808 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do I create a navigation bar accross the top of the page?

I want to create a top navigation bar:

Home Products Services About Contact
>Product A
Product B
I have been trying to use web.sitemap as the source for a menu control as
show in the example:

<?xml version="1.0" encoding="utf-8" ?>

<siteMap>
<siteMapNode title="Home" description="Home" url="~/default.aspx">
<siteMapNode title="Products" description="Our products"
url="~/Products.aspx">
<siteMapNode title="Hardware" description="Hardware choices"
url="~/Hardware.aspx" />
<siteMapNode title="Software" description="Software choices"
url="~/Software.aspx" />
</siteMapNode>
<siteMapNode title="Services" description="Services we offer"
url="~/Services.aspx">
<siteMapNode title="Training" description="Training classes"
url="~/Training.aspx" />
<siteMapNode title="Consulting" description="Consulting
services"
url="~/Consulting.aspx" />
<siteMapNode title="Support" description="Supports plans"
url="~/Support.aspx" />
</siteMapNode>
</siteMapNode>
</siteMap>

<%@ Page Language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >

<!-- For the hover styles of the Menu control to -->
<!-- work correctly, you must include this head -->
<!-- element. -->
<head id="Head1" runat="server">
<title>Menu DataBinding Example</title>
</head>

<body>
<form id="form1" runat="server">

<h3>Menu DataBinding Example</h3>

<!-- Bind the Menu control to a SiteMapDataSource control. -->
<asp:menu id="NavigationMenu"
disappearafter="2000"
staticdisplaylevels="2"
staticsubmenuindent="10"
orientation="Vertical"
font-names="Arial"
target="_blank"
datasourceid="MenuSource"
runat="server">

<staticmenuitemstyle backcolor="LightSteelBlue"
forecolor="Black"/>
<statichoverstyle backcolor="LightSkyBlue"/>
<dynamicmenuitemstyle backcolor="Black"
forecolor="Silver"/>
<dynamichoverstyle backcolor="LightSkyBlue"
forecolor="Black"/>

</asp:menu>

<asp:SiteMapDataSource id="MenuSource"
runat="server"/>

</form>
</body>
</html>
This and other examples I have tried don't show it the way I illustrated at
the top of this email; they always seem to have the Home link as the focal
point. When I try to amend the web.sitemap to include another top-level
siteMapNode next to Home (e.g. Products) the XML gives an error.

Any idea why this is?

TIA

Jul 8 '08 #1
3 1947


"Mark B" <no*****@none.comwrote in message
news:ey**************@TK2MSFTNGP02.phx.gbl...
I want to create a top navigation bar:

Home Products Services About Contact
>Product A
>Product B

I have been trying to use web.sitemap as the source for a menu control as
show in the example:

<?xml version="1.0" encoding="utf-8" ?>

<siteMap>
<siteMapNode title="Home" description="Home" url="~/default.aspx">
<siteMapNode title="Products" description="Our products"
url="~/Products.aspx">
<siteMapNode title="Hardware" description="Hardware choices"
url="~/Hardware.aspx" />
<siteMapNode title="Software" description="Software choices"
url="~/Software.aspx" />
</siteMapNode>
<siteMapNode title="Services" description="Services we offer"
url="~/Services.aspx">
<siteMapNode title="Training" description="Training classes"
url="~/Training.aspx" />
<siteMapNode title="Consulting" description="Consulting
services"
url="~/Consulting.aspx" />
<siteMapNode title="Support" description="Supports plans"
url="~/Support.aspx" />
</siteMapNode>
</siteMapNode>
</siteMap>

<%@ Page Language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >

<!-- For the hover styles of the Menu control to -->
<!-- work correctly, you must include this head -->
<!-- element. -->
<head id="Head1" runat="server">
<title>Menu DataBinding Example</title>
</head>

<body>
<form id="form1" runat="server">

<h3>Menu DataBinding Example</h3>

<!-- Bind the Menu control to a SiteMapDataSource control. -->
<asp:menu id="NavigationMenu"
disappearafter="2000"
staticdisplaylevels="2"
staticsubmenuindent="10"
orientation="Vertical"
font-names="Arial"
target="_blank"
datasourceid="MenuSource"
runat="server">

<staticmenuitemstyle backcolor="LightSteelBlue"
forecolor="Black"/>
<statichoverstyle backcolor="LightSkyBlue"/>
<dynamicmenuitemstyle backcolor="Black"
forecolor="Silver"/>
<dynamichoverstyle backcolor="LightSkyBlue"
forecolor="Black"/>

</asp:menu>

<asp:SiteMapDataSource id="MenuSource"
runat="server"/>

</form>
</body>
</html>
This and other examples I have tried don't show it the way I illustrated
at the top of this email; they always seem to have the Home link as the
focal point. When I try to amend the web.sitemap to include another
top-level siteMapNode next to Home (e.g. Products) the XML gives an error.

Any idea why this is?
Home is the focal point, because in your XML. Home is a top level node and
it has got childs.

As an idea, you need to modify your sitemap XML like this

<siteMapNode title="Home" description="Home" url="~/default.aspx" / <!--
Note the ending tag here -->
<siteMapNode title="Products" description="Our products"
url="~/Products.aspx">
<siteMapNode title="Hardware" description="Hardware choices"
url="~/Hardware.aspx" />
<siteMapNode title="Software" description="Software choices"
url="~/Software.aspx" />
</siteMapNode>
<siteMapNode title="Services" description="Services we offer"
url="~/Services.aspx">
--
Madhur
Jul 8 '08 #2
I get :

"Parser Error Message: The XML sitemap config file web.sitemap could not be
loaded. The 'siteMap' start tag on line 3 does not match the end tag of
'siteMapNode'. Line 21, position 7.


"Madhur" <sd*@df.comwrote in message
news:3B**********************************@microsof t.com...
>

"Mark B" <no*****@none.comwrote in message
news:ey**************@TK2MSFTNGP02.phx.gbl...
>I want to create a top navigation bar:

Home Products Services About Contact
> >Product A
>Product B

I have been trying to use web.sitemap as the source for a menu control as
show in the example:

<?xml version="1.0" encoding="utf-8" ?>

<siteMap>
<siteMapNode title="Home" description="Home" url="~/default.aspx">
<siteMapNode title="Products" description="Our products"
url="~/Products.aspx">
<siteMapNode title="Hardware" description="Hardware choices"
url="~/Hardware.aspx" />
<siteMapNode title="Software" description="Software choices"
url="~/Software.aspx" />
</siteMapNode>
<siteMapNode title="Services" description="Services we offer"
url="~/Services.aspx">
<siteMapNode title="Training" description="Training classes"
url="~/Training.aspx" />
<siteMapNode title="Consulting" description="Consulting
services"
url="~/Consulting.aspx" />
<siteMapNode title="Support" description="Supports plans"
url="~/Support.aspx" />
</siteMapNode>
</siteMapNode>
</siteMap>

<%@ Page Language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >

<!-- For the hover styles of the Menu control to -->
<!-- work correctly, you must include this head -->
<!-- element. -->
<head id="Head1" runat="server">
<title>Menu DataBinding Example</title>
</head>

<body>
<form id="form1" runat="server">

<h3>Menu DataBinding Example</h3>

<!-- Bind the Menu control to a SiteMapDataSource control. -->
<asp:menu id="NavigationMenu"
disappearafter="2000"
staticdisplaylevels="2"
staticsubmenuindent="10"
orientation="Vertical"
font-names="Arial"
target="_blank"
datasourceid="MenuSource"
runat="server">

<staticmenuitemstyle backcolor="LightSteelBlue"
forecolor="Black"/>
<statichoverstyle backcolor="LightSkyBlue"/>
<dynamicmenuitemstyle backcolor="Black"
forecolor="Silver"/>
<dynamichoverstyle backcolor="LightSkyBlue"
forecolor="Black"/>

</asp:menu>

<asp:SiteMapDataSource id="MenuSource"
runat="server"/>

</form>
</body>
</html>
This and other examples I have tried don't show it the way I illustrated
at the top of this email; they always seem to have the Home link as the
focal point. When I try to amend the web.sitemap to include another
top-level siteMapNode next to Home (e.g. Products) the XML gives an
error.

Any idea why this is?

Home is the focal point, because in your XML. Home is a top level node and
it has got childs.

As an idea, you need to modify your sitemap XML like this

<siteMapNode title="Home" description="Home" url="~/default.aspx" />
<!-- Note the ending tag here -->
> <siteMapNode title="Products" description="Our products"
url="~/Products.aspx">
<siteMapNode title="Hardware" description="Hardware choices"
url="~/Hardware.aspx" />
<siteMapNode title="Software" description="Software choices"
url="~/Software.aspx" />
</siteMapNode>
<siteMapNode title="Services" description="Services we offer"
url="~/Services.aspx">

--
Madhur

Jul 8 '08 #3
And if I delete that last / I get:

"Exactly one <siteMapNodeelement is required directly inside the <siteMap>
element. "
"Madhur" <sd*@df.comwrote in message
news:3B**********************************@microsof t.com...
>

"Mark B" <no*****@none.comwrote in message
news:ey**************@TK2MSFTNGP02.phx.gbl...
>I want to create a top navigation bar:

Home Products Services About Contact
> >Product A
>Product B

I have been trying to use web.sitemap as the source for a menu control as
show in the example:

<?xml version="1.0" encoding="utf-8" ?>

<siteMap>
<siteMapNode title="Home" description="Home" url="~/default.aspx">
<siteMapNode title="Products" description="Our products"
url="~/Products.aspx">
<siteMapNode title="Hardware" description="Hardware choices"
url="~/Hardware.aspx" />
<siteMapNode title="Software" description="Software choices"
url="~/Software.aspx" />
</siteMapNode>
<siteMapNode title="Services" description="Services we offer"
url="~/Services.aspx">
<siteMapNode title="Training" description="Training classes"
url="~/Training.aspx" />
<siteMapNode title="Consulting" description="Consulting
services"
url="~/Consulting.aspx" />
<siteMapNode title="Support" description="Supports plans"
url="~/Support.aspx" />
</siteMapNode>
</siteMapNode>
</siteMap>

<%@ Page Language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >

<!-- For the hover styles of the Menu control to -->
<!-- work correctly, you must include this head -->
<!-- element. -->
<head id="Head1" runat="server">
<title>Menu DataBinding Example</title>
</head>

<body>
<form id="form1" runat="server">

<h3>Menu DataBinding Example</h3>

<!-- Bind the Menu control to a SiteMapDataSource control. -->
<asp:menu id="NavigationMenu"
disappearafter="2000"
staticdisplaylevels="2"
staticsubmenuindent="10"
orientation="Vertical"
font-names="Arial"
target="_blank"
datasourceid="MenuSource"
runat="server">

<staticmenuitemstyle backcolor="LightSteelBlue"
forecolor="Black"/>
<statichoverstyle backcolor="LightSkyBlue"/>
<dynamicmenuitemstyle backcolor="Black"
forecolor="Silver"/>
<dynamichoverstyle backcolor="LightSkyBlue"
forecolor="Black"/>

</asp:menu>

<asp:SiteMapDataSource id="MenuSource"
runat="server"/>

</form>
</body>
</html>
This and other examples I have tried don't show it the way I illustrated
at the top of this email; they always seem to have the Home link as the
focal point. When I try to amend the web.sitemap to include another
top-level siteMapNode next to Home (e.g. Products) the XML gives an
error.

Any idea why this is?

Home is the focal point, because in your XML. Home is a top level node and
it has got childs.

As an idea, you need to modify your sitemap XML like this

<siteMapNode title="Home" description="Home" url="~/default.aspx" />
<!-- Note the ending tag here -->
> <siteMapNode title="Products" description="Our products"
url="~/Products.aspx">
<siteMapNode title="Hardware" description="Hardware choices"
url="~/Hardware.aspx" />
<siteMapNode title="Software" description="Software choices"
url="~/Software.aspx" />
</siteMapNode>
<siteMapNode title="Services" description="Services we offer"
url="~/Services.aspx">

--
Madhur

Jul 8 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
3910
by: Dave Patton | last post by:
Using my About page as an example: http://members.shaw.ca/davepatton/about.html What is the best/proper way to markup a page such as this that has "the main body" and "a navigation menu"? It...
0
2107
by: Veli-Pekka Tätilä | last post by:
Hi, My first post here. I've found some serious accessibility flaws in the Python 2.4 docs and wish they could be rectified over time. I'm very new to Python and initially contacted docs at python...
1
1068
by: David | last post by:
control? I am talking about a tab control with links to a bunch of pages which could be on the left side or accross the top of the page. I've used user controls, but having to put the user...
4
2602
by: Pål Andreassen | last post by:
We are using a TreeView defined in a MasterPage for navigation. The tree holds it's state turing postbacks just fine since it's using viewstate. But whenever a node click results in a redirect to a...
28
2649
by: laredotornado | last post by:
Hi, Surprisingly, I can't get the drop down menus to work on PC IE 6. If you roll over "PRODUCTS", normally a drop down menu appears (on Safari and Firefox), but on PC IE, nada. ...
8
20326
by: barb | last post by:
So that the world at large benefits from our efforts, here is one fully documented way to use Windows Irfanview freeware to create thumbnail web galleries (http://www.irfanview.com). STEP 1:...
0
1146
by: islandfong | last post by:
I am a beginner in ASP.NET. I am trying to use Master page to create the navigation tree. I can create the navigation tree of the header. but how can I created the navigation tree on the left hand...
3
2519
by: Raphas | last post by:
Hi, there are a lot of different scripts out there to sort a table with multiple columns. However, I want to do something specific. I have a table that is "spread" accross multiple pages....
10
2510
by: EA | last post by:
I am sure I must be missing something about building navigation bars with CSS. Yes it is a very clever and efficient way to format navigation structures on simple one navigation level webs, i.e....
0
7131
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7007
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7174
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7220
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7388
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5470
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4919
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3091
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
665
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.