khan2000
asked on
siteNavigation
hi
how do i remove "home" from this xml?, if i remove and its throwing me an error:
error:
Exactly one <siteMapNode> element is required directly inside the <siteMap> element.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Configuration.Confi gurationEr rorsExcept ion: Exactly one <siteMapNode> element is required directly inside the <siteMap> element.
Source Error:
.xml
====
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="~/Default.aspx" title="Home"> <<<<<<<<<<<<<<<<< I DO NOT WANT
<siteMapNode url="~/Books/Default.aspx" title="Books" imageUrl="books.jpg">
<siteMapNode url="~/Books/Novels.aspx" title="Novels" imageUrl="books.jpg" />
<siteMapNode url="~/Books/History.aspx" title="History" imageUrl="books.jpg" />
<siteMapNode url="~/Books/Romance.aspx" title="Romance" imageUrl="Heart.gif" />
</siteMapNode>
<siteMapNode url="~/Electronics/Default .aspx" title="Electronics" imageUrl="electronics.jpg" />
<siteMapNode url="~/DVDs/Default.aspx" title="DVDs" imageUrl="dvd.png" />
<siteMapNode url="~/Computers/Default.a spx" title="Computers" imageUrl="computer.png" />
</siteMapNode>
</siteMap>
how do i remove "home" from this xml?, if i remove and its throwing me an error:
error:
Exactly one <siteMapNode> element is required directly inside the <siteMap> element.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Configuration.Confi
Source Error:
.xml
====
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="~/Default.aspx" title="Home"> <<<<<<<<<<<<<<<<< I DO NOT WANT
<siteMapNode url="~/Books/Default.aspx"
<siteMapNode url="~/Books/Novels.aspx" title="Novels" imageUrl="books.jpg" />
<siteMapNode url="~/Books/History.aspx"
<siteMapNode url="~/Books/Romance.aspx"
</siteMapNode>
<siteMapNode url="~/Electronics/Default
<siteMapNode url="~/DVDs/Default.aspx" title="DVDs" imageUrl="dvd.png" />
<siteMapNode url="~/Computers/Default.a
</siteMapNode>
</siteMap>
Your structure is confusing me - if you don't want "home", what is going to happen to the nodes inside it (default, books, novels, history, romance...)? Are they all going to be deleted? That is what is happening at the moment, and that is where your error is coming from.
This is the structure as I see it:
<siteMapNode url="~/Default.aspx" title="Home"> << delete this and all the stuff inside it goes!!
<siteMapNode url="~/Books/Default.aspx" title="Books" imageUrl="books.jpg">
<siteMapNode url="~/Books/Novels.aspx" title="Novels" imageUrl="books.jpg" />
<siteMapNode url="~/Books/History.aspx" title="History" imageUrl="books.jpg" />
<siteMapNode url="~/Books/Romance.aspx" title="Romance" imageUrl="Heart.gif" />
</siteMapNode>
<siteMapNode url="~/Electronics/Default .aspx" title="Electronics" imageUrl="electronics.jpg" />
<siteMapNode url="~/DVDs/Default.aspx" title="DVDs" imageUrl="dvd.png" />
<siteMapNode url="~/Computers/Default.a spx" title="Computers" imageUrl="computer.png" />
</siteMapNode>
Andy
This is the structure as I see it:
<siteMapNode url="~/Default.aspx" title="Home"> << delete this and all the stuff inside it goes!!
<siteMapNode url="~/Books/Default.aspx"
<siteMapNode url="~/Books/Novels.aspx" title="Novels" imageUrl="books.jpg" />
<siteMapNode url="~/Books/History.aspx"
<siteMapNode url="~/Books/Romance.aspx"
</siteMapNode>
<siteMapNode url="~/Electronics/Default
<siteMapNode url="~/DVDs/Default.aspx" title="DVDs" imageUrl="dvd.png" />
<siteMapNode url="~/Computers/Default.a
</siteMapNode>
Andy
ASKER
i guess what im saying is, i want all in root rather then all under home:
when i copy and paste ur xml, i get this error:
Top element must be siteMap.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Configuration.Confi gurationEr rorsExcept ion: Top element must be siteMap.
when i copy and paste ur xml, i get this error:
Top element must be siteMap.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Configuration.Confi
ASKER
in other words, i have to have "home" in order to work ?
Sorry, i was not posting a new Xml file for you, I was clarifying the structure with tab indentation.
I am saying that your structure is siteMap --> siteMapNode:Home --> all other siteMapNodes. So, when you delete Home, all of your nodes inside Home are deleted as well. Then you end up with no nodes inside siteMap, and this is giving you the error.
Could you post your code? Then we might be able to help solve your problem.
Andy
I am saying that your structure is siteMap --> siteMapNode:Home --> all other siteMapNodes. So, when you delete Home, all of your nodes inside Home are deleted as well. Then you end up with no nodes inside siteMap, and this is giving you the error.
Could you post your code? Then we might be able to help solve your problem.
Andy
ASKER
well.. i do understand exactly what you saying but again what im sayin is that
can i have sitemapNode like this:
Novels
History
Romance
Electronics
?
can i have sitemapNode like this:
Novels
History
Romance
Electronics
?
Yes, you can. If you post your code I can help you get to it by refactoring your existing code.
Basically, I would get the Nodes collection from the Home node, copy it and add it to the base node, or just move it to the base node, and then delete the Home node.
Andy
Basically, I would get the Nodes collection from the Home node, copy it and add it to the base node, or just move it to the base node, and then delete the Home node.
Andy
ASKER
here is my xml
<siteMapNode url="~/Default.aspx" title="Home">
<siteMapNode url="~/Books/Default.aspx" title="Books" imageUrl="books.jpg">
<siteMapNode url="~/Books/Novels.aspx" title="Novels" imageUrl="books.jpg" />
<siteMapNode url="~/Books/History.aspx" title="History" imageUrl="books.jpg" />
<siteMapNode url="~/Books/Romance.aspx" title="Romance" imageUrl="Heart.gif" />
</siteMapNode>
<siteMapNode url="~/Electronics/Default .aspx" title="Electronics" imageUrl="electronics.jpg" />
<siteMapNode url="~/DVDs/Default.aspx" title="DVDs" imageUrl="dvd.png" />
<siteMapNode url="~/Computers/Default.a spx" title="Computers" imageUrl="computer.png" />
</siteMapNode>
<siteMapNode url="~/Default.aspx" title="Home">
<siteMapNode url="~/Books/Default.aspx"
<siteMapNode url="~/Books/Novels.aspx" title="Novels" imageUrl="books.jpg" />
<siteMapNode url="~/Books/History.aspx"
<siteMapNode url="~/Books/Romance.aspx"
</siteMapNode>
<siteMapNode url="~/Electronics/Default
<siteMapNode url="~/DVDs/Default.aspx" title="DVDs" imageUrl="dvd.png" />
<siteMapNode url="~/Computers/Default.a
</siteMapNode>
OK, I'm sorry I think I've missed an important point :-). Are you doing this by hand? I thought you were doing it programmatically.
In that case try this:
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="~/Books/Default.aspx" title="Books" imageUrl="books.jpg">
<siteMapNode url="~/Books/Novels.aspx" title="Novels" imageUrl="books.jpg" />
<siteMapNode url="~/Books/History.aspx" title="History" imageUrl="books.jpg" />
<siteMapNode url="~/Books/Romance.aspx" title="Romance" imageUrl="Heart.gif" />
</siteMapNode>
<siteMapNode url="~/Electronics/Default .aspx" title="Electronics" imageUrl="electronics.jpg" />
<siteMapNode url="~/DVDs/Default.aspx" title="DVDs" imageUrl="dvd.png" />
<siteMapNode url="~/Computers/Default.a spx" title="Computers" imageUrl="computer.png" />
</siteMap>
In that case try this:
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="~/Books/Default.aspx"
<siteMapNode url="~/Books/Novels.aspx" title="Novels" imageUrl="books.jpg" />
<siteMapNode url="~/Books/History.aspx"
<siteMapNode url="~/Books/Romance.aspx"
</siteMapNode>
<siteMapNode url="~/Electronics/Default
<siteMapNode url="~/DVDs/Default.aspx" title="DVDs" imageUrl="dvd.png" />
<siteMapNode url="~/Computers/Default.a
</siteMap>
ASKER
i get this error after i copy and past your code in my website.sitemap
Exactly one <siteMapNode> element is required directly inside the <siteMap> element.
Exactly one <siteMapNode> element is required directly inside the <siteMap> element.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks AGBrown
i just wanted to double check whether i have to have a root element or not and looks like my doubt is correct
i just wanted to double check whether i have to have a root element or not and looks like my doubt is correct
:-) got there in the end
ASKER
actually you can do that, i was playing with treeview and here is the code for that:
<asp:TreeView ID="TreeView1" runat="server" Height="248px" Width="232px" ShowCheckBoxes="All">
<Nodes>
<asp:TreeNode Text="1" Value="1">
</asp:TreeNode>
<asp:TreeNode Text="2" Value="2">
<asp:TreeNode Text="22" Value="22"></asp:TreeNode>
</asp:TreeNode>
<asp:TreeNode Text="3" Value="3"></asp:TreeNode>
<asp:TreeNode Text="4" Value="4"></asp:TreeNode>
<asp:TreeNode Text="5" Value="5">
<asp:TreeNode Text="55" Value="55"></asp:TreeNode>
</asp:TreeNode>
</Nodes>
<ParentNodeStyle BackColor="Yellow" BorderColor="Red" BorderStyle="Dotted" BorderWidth="2px"
ChildNodesPadding="3px" />
<LevelStyles>
<asp:TreeNodeStyle Font-Underline="False" />
<asp:TreeNodeStyle Font-Underline="False" />
<asp:TreeNodeStyle Font-Underline="False" />
<asp:TreeNodeStyle Font-Underline="False" />
<asp:TreeNodeStyle Font-Underline="False" />
</LevelStyles>
<SelectedNodeStyle BackColor="#FFC0C0" BorderColor="#FFFF80" BorderStyle="Solid"
BorderWidth="1px" />
<RootNodeStyle BackColor="#FFE0C0" BorderColor="Yellow" BorderStyle="Groove" BorderWidth="1px" />
</asp:TreeView>
<asp:TreeView ID="TreeView1" runat="server" Height="248px" Width="232px" ShowCheckBoxes="All">
<Nodes>
<asp:TreeNode Text="1" Value="1">
</asp:TreeNode>
<asp:TreeNode Text="2" Value="2">
<asp:TreeNode Text="22" Value="22"></asp:TreeNode>
</asp:TreeNode>
<asp:TreeNode Text="3" Value="3"></asp:TreeNode>
<asp:TreeNode Text="4" Value="4"></asp:TreeNode>
<asp:TreeNode Text="5" Value="5">
<asp:TreeNode Text="55" Value="55"></asp:TreeNode>
</asp:TreeNode>
</Nodes>
<ParentNodeStyle BackColor="Yellow" BorderColor="Red" BorderStyle="Dotted" BorderWidth="2px"
ChildNodesPadding="3px" />
<LevelStyles>
<asp:TreeNodeStyle Font-Underline="False" />
<asp:TreeNodeStyle Font-Underline="False" />
<asp:TreeNodeStyle Font-Underline="False" />
<asp:TreeNodeStyle Font-Underline="False" />
<asp:TreeNodeStyle Font-Underline="False" />
</LevelStyles>
<SelectedNodeStyle BackColor="#FFC0C0" BorderColor="#FFFF80" BorderStyle="Solid"
BorderWidth="1px" />
<RootNodeStyle BackColor="#FFE0C0" BorderColor="Yellow" BorderStyle="Groove" BorderWidth="1px" />
</asp:TreeView>
ASKER
http://aspnet.4guysfromrolla.com/images/siteMap.BulletedList1.png