This is a migrated thread and some comments may be shown as answers.

On Client Node Click disable a button

2 Answers 128 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Amirtha S
Top achievements
Rank 1
Amirtha S asked on 22 Feb 2011, 03:47 PM
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 Answers, 1 is accepted

Sort by
0
Kate
Telerik team
answered on 22 Feb 2011, 06:55 PM
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!
0
Amirtha S
Top achievements
Rank 1
answered on 01 Mar 2011, 05:43 AM
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

 

Tags
TreeView
Asked by
Amirtha S
Top achievements
Rank 1
Answers by
Kate
Telerik team
Amirtha S
Top achievements
Rank 1
Share this question
or