TextBox TextChanged Event Firing Twice with TreeView

Last post 02-20-2009 1:39 AM by mudassarkhan. 1 replies.

Sort Posts:

  • TextBox TextChanged Event Firing Twice with TreeView

    02-20-2009, 12:10 AM
    • Member
      681 point Member
    • rmdw
    • Member since 03-14-2005, 11:03 PM
    • Vancouver, BC, Canada
    • Posts 887

    I've encountered a strange phenomenon that I do not understand.  It concerns this web page, which uses the Telerik RadTreeView:

     

    Imagine you're in the Description textbox, change the value to something else, and then click on another node in the treeview.  When this occurs, textBoxDescription_TextChanged gets fired twice.  The first time the treeview's SelectedNode is the original one.  The second time the treeview's SelectedNode is the one you clicked on.

    Why is the clicking of the treeview causing the textbox's TextChanged event to be fired twice in succession?

    In case it matters, both controls reside within the same AJAX UpdatePanel.  Here are the layout definitions of these two controls:

              <rad:RadTreeView ID="treeViewMain" runat="server"
                               RetainScrollPosition="true"
                               ExpandDelay="5"
                               ShowLineImages="true"
                               OnNodeExpand="treeView_NodeExpand"
                               OnNodeClick="treeViewMain_NodeClick"
                               MultipleSelect="false"
                               AllowNodeEditing="false"
                               AutoPostBack="true"
                               Height="500px" Width="350px"
                               style="background-color:#F0F8FF"
              />

             <asp:TextBox ID="textBoxDescription" runat="server" Width="214px" onfocus="SelectText(this)" OnTextChanged="textBoxDescription_TextChanged" />

     

    Any help would be much appreciated!

    Robert

    Robert Werner
    Vancouver, BC
    Technical Blog
    Pocket Pollster
  • Re: TextBox TextChanged Event Firing Twice with TreeView

    02-20-2009, 1:39 AM
    Answer
    • All-Star
      59,913 point All-Star
    • mudassarkhan
    • Member since 02-28-2008, 5:28 AM
    • Mumbai, India
    • Posts 10,551

    Are you using VB.Net ? if yes Check whther the code has handles clauses near the selcted changed event if yes remove it

Page 1 of 1 (2 items)