my sitemap is like:
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="~/Admin/Default.aspx" title="Administration" description="">
<siteMapNode url="~/Admin/Overview.aspx" title="Übersicht" description="">
<siteMapNode url="~/Admin/UserOverview.aspx" title="Benutzer" description="">
</siteMapNode>
<siteMapNode url="~/Admin/CompanyOverview.aspx" title="Firmen" description="">
</siteMapNode>
<siteMapNode url="~/Admin/OrganisationOverview.aspx" title="Organisationen" description="">
</siteMapNode>
</siteMapNode>
<!-- LINE BREAK SHOULD BE HERE -->
<siteMapNode url="~/Admin/Settings.aspx" title="Einstellungen" description="">
</siteMapNode>
</siteMapNode>
</siteMap>
I have a TreeView binded on it with a SiteMapDataSource.
Here is it how it looks like: http://www.imgimg.de/bild_18a9b0128PNG.png.html
How I get a Linebreak in it?
Taken from this post, you can include the following to get a <hr /> tag but you'll have to disable postback for this item.
<siteMapNode title="<hr />" description="separator" url=""/>
Related
My complete menu system is not showing when Security Trimming is enabled...
I have enabled security Trimming in Web.config as follows ...
<siteMap defaultProvider="XmlSiteMapProvider" enabled="true">
<providers>
<add name="XmlSiteMapProvider"
description="Default SiteMap provider."
type="System.Web.XmlSiteMapProvider"
siteMapFile="Web.sitemap"
securityTrimmingEnabled="true" />
</providers>
</siteMap>
My Web.sitemap is as follows ...
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode>
<siteMapNode url="index.aspx" title=" Home | " description="Home Page" />
<siteMapNode url="" title=" Add | " description="Add a Record" >
<siteMapNode url="Add_a_Locum.aspx" title=" Add New Locum " description="Add a new Locum" />
</siteMapNode>
<siteMapNode url="" title=" View | " description="View Menu" >
<siteMapNode url="All_Locums.aspx" title="All Locums " description="View Locums" />
</siteMapNode>
<siteMapNode url="" title=" My Profile | " description="Profile Info" >
<siteMapNode url="login.aspx" title="View Profile" description="View" />
<siteMapNode url="" title="Edit Profile " description="Add or Edit" />
</siteMapNode>
<siteMapNode url="" title=" Vacancies |" description="My Vacancies" >
<siteMapNode url="" title="View All" description="All Vacancies" />
<siteMapNode url="" title="View Preferred" description="Preferred" />
</siteMapNode>
<siteMapNode url="" title="Locums |" description="Locum Pages" >
<siteMapNode url="~/Locums/Locumsonly.aspx" title="Locums Only" description="Restricted Page" />
</siteMapNode>
<siteMapNode url="" title=" Appointments | " description="Appointments">
<siteMapNode url="" title="My Calendar" description="Calendar"/>
</siteMapNode>
<siteMapNode url="" title=" FAQs | " description="FAQ" />
<siteMapNode url="" title=" Help |" description="Help" target="_blank"/>
<siteMapNode url="" title=" Contact Us | " description="Contact Us" />
</siteMapNode>
</siteMap>
Thinking the problem was related to Access Rules, I have removed all access rules, but this has not helped. Basically if "Security Trimming" is enabled as "True" - none of my menu is showing, but if I change the setting to "false" the whole menu shows, but obviously does not trim.
Try this on the parent siteMapNode:
<siteMapNode roles="*">
<siteMapNode url="index.aspx" title=" Home | " description="Home Page" />
...
</siteMapNode>
Hi, everyone. I have a problem related to my code for an assignment. I am trying to configure my web.sitemap file but I am getting the following when I run my code:
Exactly one element is required directly inside the 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.ConfigurationErrorsException: Exactly one element is required directly inside the element.
The siteMapNode for the url="CustomerSupport" is getting an error and it says that: The element 'siteMap' in namespace 'http://schemas.microsoft.com/AspNet/SiteMap-File-1.0' has invalid child element 'siteMapNode' in namespace
I have been stuck with this for a while. I'd really appreciate some help. Here is my code for the we.sitemap file:
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="Default.aspx" title="Home" description="">
</siteMapNode>
<siteMapNode url="Customer support.aspx" title="Customer support" description="">
<siteMapNode url="ProductRegistration.aspx" title="Register products" description="">
</siteMapNode>
<siteMapNode url="CustomerSurvey.aspx" title="Complete customer survey" description="">
</siteMapNode>
<siteMapNode url="ContactUs.aspx" title="Contact us" description="">
</siteMapNode>
</siteMapNode>
<siteMapNode url="TechnicianSupport.aspx" title="Technician support" description="">
<siteMapNode url="CustomerIncidentDisplay.aspx" title="Display customer incidents" description="">
</siteMapNode>
<siteMapNode url="IncidentUpdate.aspx" title="Update incidents" description="">
</siteMapNode>
</siteMapNode>
<siteMapNode url="Administration.aspx" title="Administration" description="">
<siteMapNode url="ProductMaintenance.aspx" title="Maintain products" description="">
</siteMapNode>
<siteMapNode url="CustomerMaintenance.aspx" title="Maintain customers" description="">
</siteMapNode>
<siteMapNode url="TechnicianMaintenance.aspx" title="Maintain technicians" description="">
</siteMapNode>
<siteMapNode url="IncidentCreation.aspx" title="Create incidents" description="">
</siteMapNode>
<siteMapNode url="TechnicianIncidentSummary.aspx" title="Display techninican incidents" description="">
</siteMapNode>
<siteMapNode url="IncidentAssignment.aspx" title="Assign incidents" description="">
</siteMapNode>
<siteMapNode url="IncidentDisplay.aspx" title="Display incidents" description="">
</siteMapNode>
<siteMapNode url="CustomerDisplay.aspx" title="Display customers" description="">
</siteMapNode>
</siteMapNode>
<siteMapNode url="Map.aspx" title="Site Map" description="">
</siteMapNode>
</siteMap>
You have many nodes where you should only have one:
Inside the main node, put the rest of them.
<siteMapNode name="this is the main node">
<siteMapNode name="1">
<siteMapNode name="11">
</siteMapNode>
<siteMapNode name="12">
</siteMapNode>
</siteMapNode>
<siteMapNode name="2">
</siteMapNode>
<siteMapNode name="3">
</siteMapNode>
</siteMapNode>
I am using a .net webforms Menu control generated from the following sitemap:
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="" title="NavigationWrapper" description="">
<siteMapNode url="/" title="Home" description="" />
<siteMapNode url="/search" title="Search" description="" />
<siteMapNode url="/contact" title="Contact" description="" />
</siteMapNode>
</siteMap>
When I click the home link, the SelectedItem property of the menu control is always null, but it works fine when clicking the other two links. I can't seem to work out why!
The only way I can seem to get around this is to create a www.abc.com/home link for my homepage, but I'd prefer not to do that.
Any help much appreciated!
Edit:
Route Collection is as follows:
routes.MapPageRoute("Home", "", "~/Default.aspx");
routes.MapPageRoute("Search", "search", "~/SearchByMap.aspx");
routes.MapPageRoute("contact", "contact", "~/Contact.aspx");
Try this:
<siteMapNode url="~/" title="Home" description="">
<siteMapNode url="/search" title="Search" description="" />
<siteMapNode url="/contact" title="Contact" description="" />
</siteMapNode>
Add this to your route collection:
public static void RegisterRoutes(RouteCollection routeCollection)
{
routeCollection.MapPageRoute("Home", "", "~/Default.aspx");
}
So, here's what I'm working on. I have an ASP.NET web app, in which the sitemap is displayed on the site.master file through the web.sitemap.
Here's the site.master:
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />
<asp:TreeView
ID="TreeView1"
runat="server"
ataSourceID="SiteMapDataSource1"
ExpandDepth="1">
</asp:TreeView>
And here's the web.sitemap:
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="~/Default.aspx" title="Home" description="Home">
<siteMapNode url="" title="Projects" description="">
</siteMapNode>
<siteMapNode url="" title="Configurations" description="Configurations">
<siteMapNode url="" title="Experiments" description="Experiments">
</siteMapNode>
<siteMapNode url="" title="Cell Line" description =""></siteMapNode>
<siteMapNode url ="" title ="Drugs">
</siteMapNode>
<siteMapNode url ="" title="Manage Configurations" />
<siteMapNode url="~/ExperimentConfigurationView.aspx" title ="Configure Experiements"/>
<siteMapNode url="~/DrugConfigurationView.aspx" title="Configure Drugs"/>
</siteMapNode>
</siteMapNode>
<siteMapNode url="" title="Drug Recipes" description="">
</siteMapNode>
</siteMapNode>
</siteMap>
Now, here's where I'm running into a problem. What I'd like to do is combine this site map with a dynamically created SiteMapProvider, and populate the sub-trees of this map. For example, the Projects, Experiments, Cell Line and Drug Recipe nodes would each have a sub-tree, populated from a datebase. Anyone have input, or a suggestion as to where to start looking?
In summary - I'd like to point the leaf siteMapNodes to a SiteMapProvider.
Solution:
I added a file DrugListProvider.cs in the root directory. That holds the code for dynamically generating the sub-tree.
I placed the following node in the Web.sitemap, where I wanted the sub-tree to appear:
<siteMapNode provider="DrugListProvider"/>
Finally, I include this in the web.config file:
<siteMap>
<providers>
<add name="DrugListProvider" type="PrivoWeb.DrugListProvider"/>
</providers>
</siteMap>
I have routing set up as follows:
void RegisterRoutes(RouteCollection routes)
{
routes.MapPageRoute("", "Home", "~/Default.aspx");
......
}
I'm implementing breadcrumbs using a SiteMapPath control:
<asp:SiteMapPath ID="SiteMapPath1" CssClass="breadCrumbs" runat="server">
</asp:SiteMapPath>
Web.sitemap is set up as follows:
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="Home" title="Home" description="Home">
<siteMapNode url="~/About" title="About" description="About">
<siteMapNode url="~/History" title="History"
description="History" />
</siteMapNode>
</siteMapNode>
</siteMap>
My problem is that when I navigate to mysite.com instead of mysite.com/default.aspx, the Home breadcrumb node does not appear. What am I missing?
UPDATE
I managed to get the "Home" node to display by updating Web.sitemap as follows:
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="Home" title="Home" description="Home">
<siteMapNode url="~/Default.aspx" title="" description="" />
<siteMapNode url="~/About" title="About" description="About">
<siteMapNode url="~/History" title="History"
description="History" />
</siteMapNode>
</siteMapNode>
</siteMap>
The only remaining problem is that the path separator is still displaying on home page for mysite.com
Is there a way to programatically render the separator invisible for the home page? The SiteMapPath control itself is in a master page.
Maybe you should change your sitemap file as follows :
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="~/" title="Global Site Name or Welcome Message" description="Home">
<siteMapNode url="~/Home" title="Home" description="" />
<siteMapNode url="~/About" title="About" description="About">
<siteMapNode url="~/History" title="History"
description="History" />
</siteMapNode>
</siteMapNode>
</siteMap>
and from the sitemapdatasource you should set ShowStartingNode="false" and I think that this solves both of your problems at once...
NOTE: of course this will require that you made this change in the global.asax file (VB):
RouteTable.Routes.MapPageRoute("Home0", "", "~/Default.aspx", True)
RouteTable.Routes.MapPageRoute("Home1", "Home", "~/Default.aspx", True)
hope this helps...