Q:

Asp.net tree view - Event not fired when Click on the same node

Is there any way to raise the SelectedNodeChanged event on selecting the node twice. I cant use the code "treeview.SelectedNode.Selected = false" as i have to show the selected node of the tree but at the same time, i want some event so that i can capture the click on node. Is there any way to do so ?
Thanks in advance

A:

What you could do is put the code in another event like the prerender and you can determine if the selection has changed by having a boolean class variable, blnIsChanged for example. This value has the default value of false is only set to true in the SelectedNodeChanged event so you can have an if statement in the prerender (or any event that would fire after the SelectedNodeChanged event) that can execute your code if blnIsChanged = false and do nothing if it = true.
Example:
Partial Class YourPageWithaAtreeView  
    Inherits System.Web.UI.Page  
Dim _blnSelectionChanged as Boolean = false

Protected Sub MyTree_SelectedNodeChanged(byval sender as object, byval e as eventargs) handles MyTree.SelectedNodeChanged  
   _blnSelectionChanged = true //The selection changed
End Sub
Protected Sub MyTree_PreRender(byval sender as object, byval e as eventargs) handles MyTree.PreRender
    if _blnSelectionChanged = false Then
      //Because the boolean is not true that means that 
      //the selected node didn't change
      //insert the code you want to execute when the user
      //clicks the already selected node
    end if
End Sub

