1

I have a list of objects and i want to bind this list with the treeview control my class is as follows

public class Tax
{
    public string TaxName { get; set; }
    public string TaxPresentationId { get; set; }
    public string ParentTaxName { get; set; }
    public string PresentationTaxName { get; set; }
    public string RoleURl { get; set; }
    public List<Tax> Child { get; set; }

    public Tax()
    {
        Childrens = new List<Tax>();
    }
}

I have one list with all the data

 List<Tax> lstreportdata = new List<Tax>();

how can i bind this list into the treeview control. thanks in advance.

5
  • You can use this tree view its a Jquery tree take a data-source and populate a tree blueshoes.org/_bsJavascript/components/tree/examples/… Commented May 22, 2012 at 12:59
  • Yes man for sure but please ans this first Commented May 22, 2012 at 13:00
  • thanks mehmood but i need to use asp.net treeview control Commented May 22, 2012 at 13:07
  • Have a look here: msdn.microsoft.com/en-us/library/d4fz6xk2(v=vs.80).aspx Commented May 22, 2012 at 13:08
  • @jrummell i have used list as a data source but it shows error HierarchicalDataBoundControl only accepts data sources that implement IHierarchicalDataSource or IHierarchicalEnumerable. Commented May 22, 2012 at 13:10

1 Answer 1

1

You can't. At least not directly. Take a look at the TreeView docs on MSDN.

The most common usage of a TreeView control is to display site map information, bound to an XmlDataSource.

You can also populate it programmatically with the PopulateOnDemand property.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.