RadTreeView events not firing

2 posts, 0 answers
  1. Rob Gaudet
    Rob Gaudet avatar
    5 posts
    Member since:
    Nov 2005

    Posted 19 Nov 2012 Link to this post

    I cannot get the events to fire??? Thoughts?


    SERVER SIDE
    protected void rtvLyst_NodeClick(object sender, Telerik.Web.UI.RadTreeNodeEventArgs e)
    {
    e.Node.Text = "NodeClick fired for this node";
    }


    CONTROL
    <div class="lystList" style="display:none; min-width:100px; min-height:200px;">
    <telerik:RadTreeView ID="rtvLyst" runat="server" OnClientNodeClicked="ClientNodeClicked" OnNodeClick="rtvLyst_NodeClick">

    </telerik:RadTreeView>
    </div>


    CLIENT SIDE
    function ClientNodeClicked(sender, eventArgs) {
    var node = eventArgs.get_node();
    alert("You clicked " + node.get_text());
    }
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 19 Nov 2012 Link to this post

    Hi Rob,

    After inspecting your code, I have found you are setting the display of div as none. Once the div's visibility is set to block, I was able to make the events fire as expected. Here is the full code that I tried.
    aspx:
    <div class="lystList" id="div1" runat="server" style="display:none; min-width:100px; min-height:200px;">
     <telerik:RadTreeView ID="rtvLyst" runat="server" OnClientNodeClicked="ClientNodeClicked" OnNodeClick="rtvLyst_NodeClick">
      <Nodes>
      <telerik:RadTreeNode Text="node1">
      <Nodes>
        <telerik:RadTreeNode Text="child"></telerik:RadTreeNode>
      </Nodes>
      </telerik:RadTreeNode>
     </Nodes>
    </telerik:RadTreeView>
    </div>
    <asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
    C#:
    protected void rtvLyst_NodeClick(object sender, Telerik.Web.UI.RadTreeNodeEventArgs e)
    {
      e.Node.Text = "NodeClick fired for this node";
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
     div1.Style.Add("display", "block;");
    }
    JS:
    function ClientNodeClicked(sender, eventArgs)
    {
      var node = eventArgs.get_node();
      alert("You clicked " + node.get_text());
    }

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top