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

how to edit sublevel node unordered list?

1 Answer 4 Views
SiteMap
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 01 Nov 2019, 03:41 PM

I am implementing the sitemap. When you add a child node, within the parent node it adds an unordered list with the class="rsmList rsmLevel1". I want to edit the unordered list that gets created to hold the child node to append a class to it like:

<ul class="rsmList rsmLevel1 newClass"></ul>

 

However, it seems like I can only edit the class of either the parent <li> or the child <li> node. Is there a way to edit the class of the <ul> that gets grouped with the child node?

1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 06 Nov 2019, 02:16 PM

Hi Paul,

Thank you for your question.

Can you please explain the whole scenario in more detail so that we get a better idea what you'd like to achieve?

The sitemap is a basic component which does not offer Server-side API for applying custom classes over the UL nodes. The provided CssClass is applied to the <li> elements:

		protected void SiteMap1_DataBound(object sender, EventArgs e)
		{
			foreach (RadSiteMapNode node in SiteMap1.GetAllNodes())
			{
				int childNodes = CountChildNodes(node);
                                node.CssClass = "MyClass";
			}
		}

If you want to apply a custom class over the UL elements or a specific UL element, you'll need to do it on the client. You can use the pageLoad() { } event of the MS AJAX framework, get reference to the li element with a class of "rsmList rsmLevel1", go to its parent element and apply the className="newClass" to it.

Best Regards,
Rumen
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
SiteMap
Asked by
Paul
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Share this question
or