Aman Kumar

Aman Kumar

  • NA
  • 4
  • 1.3k

Show data of a data table inTree View

Mar 30 2013 2:31 AM
have a Data table TblTreeView which have four columns

ParentID(pk) | ParentName| LeftChildID | RightChildID

and i want to display all data in tree view ;

like as

ParentName

|

|_LeftChildID

|

|_RightChildID

I was using

 SqlDataAdapter dataAdapter = new SqlDataAdapter("Select * from tblTreeView", SqlCon);
    DataSet dataSet = new DataSet();

    dataAdapter.Fill(dataSet);

    TreeView1.DataSource = dataSet.Tables[0];
    TreeView1.DataBind();

Then occur An error:- HierarchicalDataBoundControl only accepts data sources that implement IHierarchicalDataSource or IHierarchicalEnumerable. Please Give me a code How can i do this; Thank you Sir/Madam