|
Rank: Member Groups: Member
Joined: 11/16/2007 Posts: 13
|
Hello,
I would like to expand all nodes in my treeview.
I wanted to do this like this;
I give a dataset where a colum ExpanedField is set to 1 or 'true'.
'SELECT ExpandedField=1 ........' as sql statement
CodeBehind looks like:
public void FillCategories() { DataSet ds = DataFacade.ProductCategory.ListExpanded(System.Convert.ToInt32(rdbLanguage.SelectedValue)); DataColumn CatId = ds.Tables[0].Columns["Id"]; DataColumn ParentCatId = ds.Tables[0].Columns["ParentId"]; DataRelation r = ds.Relations.Add(CatId, ParentCatId); r.Nested = true; categoryTree.DataSource = ds; categoryTree.DataBind(); }
The databinding looks like:
<eo:DataBinding DataField="ExpandedField" Property="Expanded" />
Now i get the folowing errormessage :
Data binding failed on property Expanded. Specified cast is not valid.
What is wrong here or is it a bug in the expanded property?
Greetings
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, Expanded is a boolean, so you can only bind it to a "bit" type. Trying to bind it to any other type would get the specified cast not valid error. The easiest way for you to expand all is to call the expand all method:
Code: C#
categoryTree.DataBind();
categoryTree.ExpandAll();
Thanks
|
|
Rank: Member Groups: Member
Joined: 11/16/2007 Posts: 13
|
Good pointer thanks.
It's a bit so i did the folowing ; cast(1 as bit) as ExpandedField. Now it works.
However , are you sure the ExpandAll() function does exist in the treeview? I could not find this method.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
|
|