This is a migrated thread and some comments may be shown as answers.

Support Multiple Style Changes?

3 Answers 137 Views
SiteMap
This is a migrated thread and some comments may be shown as answers.
Seth
Top achievements
Rank 1
Seth asked on 14 Feb 2013, 04:17 AM
I have a page where I have a number of sitemap controls.  Each one may have a different background color.  For some of the sitemaps, I can use the default font, color, background hover color, etc.  For the others, I need to change different attributes.  I tried using the CssClass to override the color as well as the ForeColor attribute on the control and the nodes but alas, it did not work.  I know I can override the group css class, but that's not an option as far as I can see, it would override all of my sitemap controls.

Please advise if there is a solution to my issue.  I can supply a screenshot if that is helpful to understanding what I am trying to accomplish.

3 Answers, 1 is accepted

Sort by
0
MasterChiefMasterChef
Top achievements
Rank 2
answered on 14 Feb 2013, 07:10 PM
Hi Seth,

It should be simple enough to apply CSS classes to each siteMapNode. If you take a look at 
this demo (which is in the process of being formatted properly), you will see that each node is given a category and then given a specific css class. The only unique thing being applied to each siteMapNode is a different font color. Let's say you had a siteMapNode with category "ASPNET":
<siteMapNode title="ASP.NET AJAX Controls" category="ASPNET">
                <siteMapNode title="Description" />
                <siteMapNode title="Demos" />
                <siteMapNode title="Videos" />
</siteMapNode>

 In the code-behind you would use the 'category' variable to access specific siteMapNodes at a time. Try isolating the demo to see exactly how this is implemented.


Good luck,
Master Chief
0
Seth
Top achievements
Rank 1
answered on 15 Feb 2013, 08:52 PM
Thanks!

Only problem I am still having is that the root node text doesn't change.  What could I be doing wrong?  I have the CssClass hardcoded to the page, I don't need it dynamic like they have it as I am not databinding...
.RadSiteMap .Primary .rsmItem a.rsmLink {
    color: White !important;
}
.RadSiteMap .Primary .rsmItem a.rsmLink:hover {
    color: Black !important;
}
<telerik:RadSiteMap ID="rsmShipping" runat="server" CssClass="Primary">
    <Nodes>
        <telerik:RadSiteMapNode Text="Shipping" runat="server" Enabled="false" CssClass="Primary">
            <Nodes>
                <telerik:RadSiteMapNode Text="My Shipments" runat="server"></telerik:RadSiteMapNode>
                <telerik:RadSiteMapNode Text="Create A Shipment" runat="server"></telerik:RadSiteMapNode>
                <telerik:RadSiteMapNode Text="My Manifests" runat="server"></telerik:RadSiteMapNode>
            </Nodes>
        </telerik:RadSiteMapNode>
    </Nodes>
</telerik:RadSiteMap>
0
Kate
Telerik team
answered on 19 Feb 2013, 01:34 PM
Hello Seth,

You can use the following css class selectors in case you need to change the different color of the different level of nodes in the RadSiteMap control:
/*setting color for the zero level nodes in the sitemap */
       div.RadSiteMap_Default .rsmLevel .rsmItem.rsmDisabled.Primary a.rsmLink {
           color: red;
       }
 
           div.RadSiteMap_Default .rsmLevel .rsmItem.rsmDisabled.Primary a.rsmLink:hover {
               color: black;
           }
       /*setting color for the first level nodes in the sitemap */
       div.RadSiteMap_Default .rsmLevel .rsmItem.rsmDisabled.Primary .rsmLevel1 .rsmItem a.rsmLink {
           color: green !important;
       }
 
           div.RadSiteMap_Default .rsmLevel .rsmItem.rsmDisabled.Primary .rsmLevel1 .rsmItem a.rsmLink:hover {
               color: yellow !important;
           }

Greetings,
Kate
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
SiteMap
Asked by
Seth
Top achievements
Rank 1
Answers by
MasterChiefMasterChef
Top achievements
Rank 2
Seth
Top achievements
Rank 1
Kate
Telerik team
Share this question
or