• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 816
  • Last Modified:

second click on treeview node with no selection change

Hi
I am working with TreeView in c#. I have an OnSelectedNodeChanged method.
When the user selects a node, it's caught and dealt with. But when the user selects the same node again, I can't catch it because I hadn't found a callback that deal with this.
Thanks
Osnat
0
Relegence
Asked:
Relegence
  • 4
  • 3
1 Solution
 
Priest04Commented:
As event name says, OnSelectedNodeChanged, it is fired when the selected node is changed. In your case, selection is not changing. Use Click event instead.

Goran
0
 
RelegenceAuthor Commented:
there is no such even for treeview..
i couldn't find any "onclick", "click", "onselect"..

0
 
Priest04Commented:
Ah sorry, its an ASP.NET treeview. Yes, you are correct there is no Click event. YTou could get away with this:


protected void TreeView1_SelectedNodeChanged(object sender, EventArgs e)
{
    TreeView1.SelectedNode.Selected = false;
}

Open in new window

0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
RelegenceAuthor Commented:
Except i am not changing a node, therefore it never gets there. that's actually my problem, because i do have one OnSelectedNodeChanged method working already.
Again - I need something to catch a Non selection-change-click. Just a click on the Same node.
In this case, postback is called, but how can i catch this event?
0
 
Priest04Commented:
Relegance, TreeView has a SelectedNodeChanged event. This event is fired when the different node is selected. So, in order to circumvent this, in the SelectedNodeChanged event we set curently selected Node's property Selected to false. Therefore, NO node is currently selected (at least this is what tree view thinks). So, after you click on the selected node AGAIN, it will check whether node that is clicked is selected, and since we set it as unselected, it will raise SelectedNodeChanged event again.

I dont understand what exactly you didnt understand. Or maybe I didnt? :)
0
 
RelegenceAuthor Commented:
You are right, now i understand, i must have missed a part.
Thanks
0
 
Priest04Commented:
Then why did you give me B grade? What part of the question is left unanswered?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now