On Client Node Click disable a button

3 posts, 0 answers
  1. Amirtha S
    Amirtha S avatar
    16 posts
    Member since:
    Feb 2010

    Posted 22 Feb 2011 Link to this post

    Hi
    I am trying to disable a button whenever a node is clicked.from the client side.

    The Treeview has PostBack disable in it.

    Also I notice that the Alerts inside the javascript functions are not firing up.

    The code is a ascx file which is called from a aspx page. The Treeview sits in a RadAjaxPanel.

    I make use of the following code with no success:

     

     

     

     

    <script type="text/javascript">
                function AssignEventHandler() {
                    alert("inside Assign");
                    var tree = $find("<%= rdTreeVwHIOptions.ClientID %>");
                    tree.add_nodeClicked(ClientNodeClicked);
                }
      
                function ClientNodeClicked(sender, args) {
      
                    alert("Node clicked!");
                    var btn = $find("<%= btnSave.ClientID %>");
                    btn.disabled = true;
                                      
                            
      
            </script>

     

    Pls help me find a solution for this.

    Thanks,
    Amirtha

     

     

     

     

  2. Kate
    Admin
    Kate avatar
    1898 posts

    Posted 22 Feb 2011 Link to this post

    Hello Amirtha S,

    Here is a sample page demonstrating that the alert function works just fine when using RadButton. Since ASP.NET controls do not support client side programming the alert function may not fire in case you are using a simple ASP.NET Button control.

    I also included a function that checks if the user have clicked the right node to disable the RadButton (in the particular case I used get_text() property to compare the text property of the "Root RadTreeNode 2" with the selected node).

    Greetings,
    Kate
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  3. Amirtha S
    Amirtha S avatar
    16 posts
    Member since:
    Feb 2010

    Posted 28 Feb 2011 Link to this post

    Hi Kate,
    Thanks for you timely response.

    Sorry we don't have the option of using RadButton as the version of Telerik our company is using now doesn't have the control.

    Hence we ended up making use of this to disable the asp.net button:

    rdTreeVwOptions.Attributes[

    "onclick"] = "DisableSave();";

    Thanks,
    Amirtha

     

Back to Top