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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to apply HtmlAttributes for nodes in Treeview?

Description

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

Solution

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.

CSHTML

C#               

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

C#               

 

Article ID: Published Date: Last Revised Date: Platform: Control: Product Version:
3540 01/28/2015 02/02/2015 ASP.NET MVC (Classic) TreeView 12.4.0.24
Did you find this information helpful?
Add Comment
You must log in to leave a comment

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