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

edit nodes properties in run-time

4 Answers 75 Views
Treeview
This is a migrated thread and some comments may be shown as answers.
memol
Top achievements
Rank 1
memol asked on 04 Feb 2009, 09:33 PM
Hi
I want to edit nodes.text or nodes.font in run time ! but when i try to it got error .
whats the problem ?

treeview1.Nodes("node1").Font.Bold = False

please help me

4 Answers, 1 is accepted

Sort by
0
Victor
Telerik team
answered on 05 Feb 2009, 01:30 PM
Hi memol,
 
Thank you for writing.
 
You should not try to assign values to the Font.Bold property as it is readonly. Instead create a new Font object like so:
 
radTreeView1.Nodes["Some node"].Font = new Font("Arial", 8, FontStyle.Regular);
 
 
I hope this answers your question. Please write back if you have more questions.
 

Regards,
Victor
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
memol
Top achievements
Rank 1
answered on 05 Feb 2009, 06:04 PM
Hi
thanks dear for reply :)

in this way i can edit nodes properties via index or nodes text. how can i access to these property by nodes.name ?

working  with index decrease code-readability  . and working with node.text is not suitable for me (node.text maybe changed more time in run-time")

how to access to nodes by names ?
0
Accepted
Victor
Telerik team
answered on 06 Feb 2009, 04:40 PM
Hi memol,

Thank you for writing.
You can search by name using RadTreeNodeCollection's Find() method, it returns an array of found nodes. You can use it like so:
private void radButton1_Click(object sender, EventArgs e)  
{  
    // The second argument indicates whether to search recursively.  
    RadTreeNode[] foundNodes = radTreeView1.Nodes.Find("SomeNode"true);  
    MessageBox.Show(foundNodes[0].Text);  
I hope this is what you are looking for. Please write back if you have other questions.

Best wishes,
Victor
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
memol
Top achievements
Rank 1
answered on 08 Feb 2009, 09:07 PM
Hi
Thanks . :)

Tags
Treeview
Asked by
memol
Top achievements
Rank 1
Answers by
Victor
Telerik team
memol
Top achievements
Rank 1
Share this question
or