Welcome Guest Search | Active Topics | Sign In | Register

TreeView > Expand all nodes Options
KoenL
Posted: Friday, June 13, 2008 6:41:16 AM
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

eo_support
Posted: Friday, June 13, 2008 8:58:14 AM
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
KoenL
Posted: Sunday, June 15, 2008 11:47:30 PM
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.
eo_support
Posted: Monday, June 16, 2008 12:00:00 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

It exists in the latest version:

http://www.essentialobjects.com/ViewDoc.aspx?t=EO.Web.TreeView.ExpandAll.html

It didn't exist in early versions.

Thanks


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.