0

I manually select my Node in Treeview:

treeView1.SelectedNode = treeView1.Nodes[0].Nodes[0].Nodes[0]; 

But I want to click it also, not only select, cause I load data from XML into Form, depended on which Node has been clicked..

How to do this clickevent on the specified Node?

0

2 Answers 2

2

To add to Saeed Amiri's answer, if you are using WinForms I think you need to add listeners to BeforeSelect or AfterSelect, instead of SelectedNodeChanged.

Sign up to request clarification or add additional context in comments.

Comments

1

I suggest trigger fetching data by SelectedNodeChanged, not onclick, because may be user click on one node multiple times and every time should wait for fetching new data but in fact there isn't any changes in data, Also you should do functionality of fetching data in separate method not in events, in events you should just call them (kind of single responsibility principle:).

1 Comment

I think it is not available on WinForms, only in System.Web.UI.WebControls.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.