DataBinding : Change the node name in the treeView

4 posts, 0 answers
  1. anouar b
    anouar b avatar
    13 posts
    Member since:
    Jul 2009

    Posted 05 Aug 2009 Link to this post

    Hello,

    I am generating a treeView from 3 SQL Server tables.
    I added the binding sources, table adapter .... 
    I write this code:

     

    this.villeTableAdapter.Fill(this.logisticsDataSet.Ville);
    /
    / TODO: This line of code loads data into the 'logisticsDataSet.Region_2' table. You can move, or remove it, as needed. 

     

     

    this.region_2TableAdapter.Fill(this.logisticsDataSet.Region_2);
    // TODO: This line of code loads data into the 'logisticsDataSet.Region_1' table. You can move, or remove it, as needed. 
    this.region_1TableAdapter.Fill(this.logisticsDataSet.Region_1);

    // TODO: This line of code loads data into the 'logisticsDataSet.Pays' table. You can move, or remove it, as needed.

     

    this.paysTableAdapter.Fill(this.logisticsDataSet.Pays);
    this.radTreeView1.RelationBindings.Add(new RelationBinding("FK_Reg_1_Cont", this.Region1bindingSource)); this.radTreeView1.RelationBindings.Add(new RelationBinding("FK_Reg_2_Reg_1", this.Region2bindingSource));this.radTreeView1.RelationBindings.Add(new RelationBinding("FK_Emp_Reg_2", this.Region2bindingSource));

    this.radTreeView1.RootRelationDisplayName = "Cont";
    this.radTreeView1.DataSource = this.paysBindingSource;

    Now my treeView is correctly populated.

    My problem is how the change the text displayed in the treeNode because i want that the treeView another column name (and in the future i want to customize the text displayed in the treeNode) ?
    Thanks in advance.

     

     

     

  2. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 05 Aug 2009 Link to this post

    Hi anouar b,

    Thank you for writing. You can set the Text property of RadTreeNode to whatever text you need. Please write again if I have misunderstood your question or if this is not the solution you are looking for.

    All the best,
    Victor
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. anouar b
    anouar b avatar
    13 posts
    Member since:
    Jul 2009

    Posted 05 Aug 2009 Link to this post

    But i want that the text will be binded to the corresponding tableAdapter.

    I want to change the text of the Items automatically displayed.

    For exemple if i have a table named 'pays' in my database which contains the following columns :
    Pays_Name
    Pays_Code 
    Pays_ID

    i want that all the treeNodes of 'Pays' take as text not only "Pays_Name" but "Pays_Name" cantatened with "Pays_code"
  5. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 07 Aug 2009 Link to this post

    Hi anouar b,

    This is a very custom scenario and RadTreeView does not account for it. You will have to come up with your own  solution in order to bind the tree view in such a specific manner.

    Greetings,
    Victor
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top