Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

second click on treeview node with no selection change

Posted on 2008-10-06
7
Medium Priority
?
790 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 18

Expert Comment

by:Priest04
ID: 22651351
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
ID: 22651422
there is no such even for treeview..
i couldn't find any "onclick", "click", "onselect"..

0
 
LVL 18

Expert Comment

by:Priest04
ID: 22651623
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
Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

 

Author Comment

by:Relegence
ID: 22657671
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 375 total points
ID: 22657735
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
ID: 22658318
You are right, now i understand, i must have missed a part.
Thanks
0
 
LVL 18

Expert Comment

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

Featured Post

Simplify Your Workload with One Tool

How do you combat today’s intelligent hacker while managing multiple domains and platforms? By simplifying your workload with one tool. With Lunarpages hosting through Plesk Onyx, you can:

Automate SSL generation and installation with two clicks
Experience total server control

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

These days, all we hear about hacktivists took down so and so websites and retrieved thousands of user’s data. One of the techniques to get unauthorized access to database is by performing SQL injection. This article is quite lengthy which gives bas…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This video teaches viewers how to create their own website using cPanel and Wordpress. Tutorial walks users through how to set up their own domain name from tools like Domain Registrar, Hosting Account, and Wordpress. More specifically, the order in…
Learn how to set-up custom confirmation messages to users who complete your Wufoo form. Include inputs from fields in your form, webpage redirects, and more with Wufoo’s confirmation options.

721 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