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

Enabling or Disabling RadTreeView in CLient Side

11 Answers 287 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Avik
Top achievements
Rank 1
Avik asked on 27 Jun 2008, 08:51 AM
I am trying to both enable and disable the RadTree view from the client side(javascript). I am at the point where I have the ClientID of the tree view but I am not able to access any property by which I can enable or disable the controls in the javascript.

11 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 27 Jun 2008, 09:04 AM
Hello Avik,

You can check the following help articles:

http://www.telerik.com/help/aspnet-ajax/tree_clientprogramming.html
http://www.telerik.com/help/aspnet-ajax/tree_clientradtreeviewobject.html

Regards,
Albert
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Avik
Top achievements
Rank 1
answered on 27 Jun 2008, 12:25 PM
Thanks for your reply Albert.

But still I am having some problem with it.
I tried with set_enabled(false/true) or get_enabled(). But it is always showing as  Object doesn't support this property or method Error.

I am giving the complete ClientID from the debugger here  ctl00_cphMainContent_rTreeView.get_enabled().

Please let me know if I am doing something wrong or what else can I do.




0
Atanas Korchev
Telerik team
answered on 27 Jun 2008, 12:26 PM
Hello Avik,

You are not accessing correctly the treeview client-side object. Please check the first help article for more details.

All the best,
Albert
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Avik
Top achievements
Rank 1
answered on 27 Jun 2008, 01:21 PM

Hi Albert,

 From the link provided - "http://www.telerik.com/help/aspnet-ajax/tree_clientradtreeviewobject.html'

  I tried implementing the below function in my application; 

function disableTreeView()
{
   var tree = $find("<%= RadTreeView1.ClientID %>");
   if(tree.get_enabled())
   {
      tree.set_enabled(false);
   }
   else
   {
      tree.set_enabled(true);
   }    
}

Query 1: I'm unable to execute code with "$find", Is it a javascript built-in function? 

Query 2: Instead of "$find", I tried the following:

var ctrl='<%=rTreeView.ClientID%>';
var tree = document.getElementById(ctrl);
tree.set_enabled(true);

But the above code threw an error saying "Object does not support set_enabled method". I'm using RadTreeView.Net2.dll - version: 6.0.3.0.
Please let me know whether its supported in this version.

Regards,
Avik Basu

0
Atanas Korchev
Telerik team
answered on 27 Jun 2008, 01:25 PM
Hello Avik,

$find is built-in function in ASP.NET Ajax. Which version of RadTreeView are you using? It seems you are not using RadTreeView for ASP.NET Ajax albeit you have specified so.

Regards,
Albert
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Avik
Top achievements
Rank 1
answered on 01 Jul 2008, 11:30 AM
Hi Albert,

Even if I'm not using the latest version of radtreeview, I'm able to enable the text of the nodes of the radtree, but not being able to enable the checkboxes related to the nodes.

In the server side I'm using the code to disable as

rTreeView.Enabled=false;

In the client side I'm looping through the whole radtree and making each node enable as

tree.AllNodes[i].Enabled=true

What is the wrong with this approach, that it is not enabling completely (only on clicking on the text the checkbox is getting checked but the checkbox itself is disabled)?

What is the alternative solution to enable both the checkboxes and the nodes with the current version I'm using?
0
Accepted
Atanas Korchev
Telerik team
answered on 01 Jul 2008, 11:38 AM
Hi Avik,

You should use the Enable()/Disable() client-side methods of the RadTreeNode object. Setting the  Enable field will not disable the checkbox.

Regards,
Albert
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Avik
Top achievements
Rank 1
answered on 01 Jul 2008, 11:55 AM
Thanks a lot Albert it's working fine now with the Enable()/Disable() method.
0
Avik
Top achievements
Rank 1
answered on 02 Jul 2008, 11:00 AM
Hi Albert,

The radtreeview is working fine now. But I am again facing a small problem in enabling a radDatePicker control.

The current scenario is like I have enabled the textbox of the radDatePicker but on clicking of the calendar popup button the calendar is not shown.

I have used the following piece of code.

document.getElementById(obj17).parentElement.disabled=

false;
objrDatePicker.DateInput.Enable();

Please help me tp enable the calendar control.

Regards,
Avik





0
Avik
Top achievements
Rank 1
answered on 02 Jul 2008, 02:02 PM
I right noe being able to get the calendars on clicking of the raddatepicker but there are a few problems which I am still facing (I am making the radDatePicker enabled=false in the server side)

1. I got the user controls so when I am using the code like:

obj16.PopupButton.onclick =

function()

{

 obj16.TogglePopup();

 return false;

}

it is always coming beside one control, I am not getting two calendars for eah of the two radDatePicker.



2. On clicking on any date, the selected date is not appearing in the textbox of the datepicker.


How will I able to get the control enabled from the client side.


Plese let me know ASAP because it's very urgent for me

Regards,
Avik

0
Veli
Telerik team
answered on 02 Jul 2008, 04:17 PM
Hello Avik,

You can enable and disable RadDatePicker totally on the client in the following way. We have two RadDatePickers and a button which toggeles the enabled/disabled state:

        <table> 
        <tr> 
            <td> 
                <telerik:RadDatePicker ID="Picker1" runat="server"
                </telerik:RadDatePicker> 
            </td> 
            <td> 
                <telerik:RadDatePicker ID="Picker2" runat="server"
                </telerik:RadDatePicker> 
            </td> 
            <td> 
                <asp:LinkButton ID="Button1" runat="server" Text="Disable" OnClientClick="return Click(this, event);"></asp:LinkButton> 
            </td> 
        </tr> 
        </table> 

And we define the javascript Click() event handler in the following way:

        function Click(sender, args) 
        { 
            var picker1 = $find("<%= Picker1.ClientID %>"); 
            var picker2 = $find("<%= Picker2.ClientID %>"); 
             
            picker1.set_enabled(!picker1.get_enabled()); 
            picker2.set_enabled(!picker2.get_enabled()); 
             
            if(picker1.get_enabled()) 
                sender.innerHTML = "Disable"
            else 
                sender.innerHTML = "Enable"
              
            return false
        } 

This code toggles between the enabled/disabled states of the two RadDatePickers. When RadDatePicker is disabled, it is grayed out and inaccessible both for the input and for the calendar button.

Kind regards,
Veli
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
TreeView
Asked by
Avik
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Avik
Top achievements
Rank 1
Veli
Telerik team
Share this question
or