Solved

second click on treeview node with no selection change

Posted on 2008-10-06
7
754 Views
Last Modified: 2012-06-21
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
Comment
Question by:Relegence
  • 4
  • 3
7 Comments
 
LVL 18

Expert Comment

by:Priest04
Comment Utility
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
 

Author Comment

by:Relegence
Comment Utility
there is no such even for treeview..
i couldn't find any "onclick", "click", "onselect"..

0
 
LVL 18

Expert Comment

by:Priest04
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:Relegence
Comment Utility
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
 
LVL 18

Accepted Solution

by:
Priest04 earned 125 total points
Comment Utility
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
 

Author Comment

by:Relegence
Comment Utility
You are right, now i understand, i must have missed a part.
Thanks
0
 
LVL 18

Expert Comment

by:Priest04
Comment Utility
Then why did you give me B grade? What part of the question is left unanswered?
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Thoughout my experience working on eCommerce web applications I have seen applications succumbing to increased user demand and throughput. With increased loads the response times started to spike, which leads to user frustration and lost sales. I ha…
It’s a strangely common occurrence that when you send someone their login details for a system, they can’t get in. This article will help you understand why it happens, and what you can do about it.
This video teaches users how to migrate an existing Wordpress website to a new domain.
Wufoo.com provides powerful tools for surveying targeted groups, and utilizing data from completed surveys to find trends, discover areas of demand or customer expectation, and make business decisions on products or services.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now