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

Combobox enable/disable through JavaScript

2 Answers 317 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Babul Sahu
Top achievements
Rank 1
Babul Sahu asked on 28 Oct 2009, 07:00 AM
Hi,

I want to disable/enable RadComboBox on item selection changes of another RadCombobox.

I am trying to achieve this by using below code snippet, but getting error "Disable()" is not a valid method.

<rad:RadComboBox id="Combo1" runat="server" OnClientSelectedIndexChanging="LoadCombo2">  
         <Items> 
       <rad:RadComboBoxItem runat="server" Text="RadComboBoxItem1"></rad:RadComboBoxItem> 
       <rad:RadComboBoxItem runat="server" Text="RadComboBoxItem2"></rad:RadComboBoxItem> 
       <rad:RadComboBoxItem runat="server" Text="RadComboBoxItem3"></rad:RadComboBoxItem> 
       <rad:RadComboBoxItem runat="server" Text="RadComboBoxItem4"></rad:RadComboBoxItem> 
    </Items> 
         </rad:RadComboBox> 
<rad:RadComboBox id="Combo2" runat="server" OnClientItemsRequested="SetCombo2">  
<Items> 
       <rad:RadComboBoxItem runat="server" Text="RadComboBoxItem1"></rad:RadComboBoxItem> 
       <rad:RadComboBoxItem runat="server" Text="RadComboBoxItem2"></rad:RadComboBoxItem> 
       <rad:RadComboBoxItem runat="server" Text="RadComboBoxItem3"></rad:RadComboBoxItem> 
       <rad:RadComboBoxItem runat="server" Text="RadComboBoxItem4"></rad:RadComboBoxItem> 
    </Items> 
</rad:RadComboBox> 
 
<script type="text/javascript">  
var ThisCombo2 = <%= Combo2.ClientID %>;  
 
function LoadCombo2(item) {  
 ThisCombo2.Disable();  
 ThisCombo2.ClearSelection();  
 ThisCombo2.RequestItems(item.Value, false); }  
 
function SetCombo2(item) {  
 item.SetText(item.Items[0].Text);  
 item.Enable();  
 if (item.Items.length > 1) { item.ShowDropDown(); } } </script> 
 


With Regards,
Babul

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 28 Oct 2009, 08:30 AM
Hi Babul,

I tried the code with RadControls ASP.NET version and found the Disable() method works fine. I hope you are using different version of RadControls and thats why getting the error. Checkout the documentation which shows how to enable/ disable RadComboBox if you are using RadControls for ASP.NET AJAX.
Client-Side Basics

Could you provide the version of RadControls that you are using if this does not help?

-Shinu.
0
Babul Sahu
Top achievements
Rank 1
answered on 28 Oct 2009, 12:38 PM
Hi Shinu,
   I am using telerik version - 2008.2.1001.35.

With Regards,
Babul
Tags
ComboBox
Asked by
Babul Sahu
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Babul Sahu
Top achievements
Rank 1
Share this question
or