Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1660
Webdatatree Node color text
posted

Hai,

I have a webdatatreee like the below image. 

Here, I populate the datatree from datasets. In the datasets, i have one column like 'IS ACTIVE'. It may be 0 or 1.

I want to populate the webdatatree with some color in nodes. Suppose the node has IS ACTIVE field 0 means it will show in red color, and 1 means it will show blue color. 

How can i do this?

Thanks in advance.

Parents
No Data
Reply
  • 25665
    Offline posted

    Hello Thangachan,

    Thank you for contacting Infragistics!

    I have done some looking into this matter and have found you can achieve this by handling the NodeBound event of the WebDataTree. In that you can check the value and assign a CssClass to the node based on that value:

    protected void WebDataTree1_NodeBound(object sender, DataTreeNodeEventArgs e)
        {
            int value = (int)((System.Data.DataRowView)(((Infragistics.Web.UI.Framework.Data.DataSetNode)(e.Node.DataItem)).Item)).Row.ItemArray[0];
            if (value == 0)
            {
                e.Node.CssClass = "styleNam1";
            }
            else if (value == 1)
            {
                e.Node.CssClass = "styleNam2";
            }
        }

    Please let me know if you have any further questions concerning this matter.

Children