This is a migrated thread and some comments may be shown as answers.

Binding Dataset with Filter causes Problems

1 Answer 69 Views
Treeview
This is a migrated thread and some comments may be shown as answers.
Karl
Top achievements
Rank 1
Karl asked on 11 Jun 2012, 06:13 PM
Hi,

In the code below I have a dataset connected to a radTreeView. It is recursive and it works. When I try to filter the dataset with the .Select command the radTreeView knows there is data there but the displaymember stays blank - meaning no text in the tree. Why?

Thanks,
Karl 

private void BindLangDataToTree()
{
    this.radTreeView1.DisplayMember = "Thema_" + myLang; ;
    this.radTreeView1.ParentMember = "pid";
    this.radTreeView1.ChildMember = "id";
    this.radTreeView1.ValueMember = "id";
    radTreeView1.DataSource =  ds_Baum.Tables["Baum"];//.Select("Schule='" + mySchuleID + "'");
}

1 Answer, 1 is accepted

Sort by
0
Julian Benkov
Telerik team
answered on 13 Jun 2012, 10:21 AM
Hi Karl,

Please use the RowFilter property of DefaultView to filter data instead of the Select method of DataSet to save the data binding consistency and performance of your application. Here is the changed code snippet:
private void BindLangDataToTree()
{
    this.radTreeView1.DisplayMember = "Thema_" + myLang; ;
    this.radTreeView1.ParentMember = "pid";
    this.radTreeView1.ChildMember = "id";
    this.radTreeView1.ValueMember = "id";
    ds_Baum.Tables["Baum"].DefaultView.RowFilter = "Schule='" + mySchuleID + "'";
    radTreeView1.DataSource = ds_Baum.Tables["Baum"];
}

I hope this helps. Let me know if you need further assistance.

Kind regards,
Julian Benkov
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
Tags
Treeview
Asked by
Karl
Top achievements
Rank 1
Answers by
Julian Benkov
Telerik team
Share this question
or