We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to apply HtmlAttributes for nodes in Treeview?

Platform: ASP.NET MVC (Classic) |
Control: TreeView |
Product Version:


You can easily map and apply the Html Attribute to TreeView items by using HtmlAttributes property in TreeViewModel class.


For applying the Html Attribute to the TreeView items, you have to configure some of the following properties in TreeView model.

  1. Map the HtmlAttributes property to the DataSource field.

C:\Users\ApoorvahR\Desktop\Note.png Note: When LoadOnDemand is required, enable “LoadOnDemand” and assign “RequestMapper” value.

The value of HtmlAttributes should be in the following format,

  1. In order to assign the value to the attribute, use “=” character.

Example: “style=background-color: red; font-weight: bold; height: 21px;

  1. To apply a multiple attribute value’s, use comma (“,”) to separate each attribute and its value.

Example: “style=background-color: red; font-weight: bold;, height= 21px, width=100px

Sample Table Data:

Figure 1: Sample Table Data

Refer to the following code example for SQL Data Binding.



Refer to the following code example for TreeView SQL Data binding with LoadOnDemand.



You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile