
I am trying to use the disable() javascript function to disable my dropdown but get the error message that the object does not support the method; I am using the combobox version "RadControls for ASPNET AJAX Q2 2008".
I am using the following code to try to disable the drop down: (the location combo box id is stored in a hidden text box locationTypeDDID)
locationTypeDD = document.getElementById(locationTypeDDID.value);
locationTypeDD.disabled();
I have also tried using code similar to:
var combo = $find("<%= RadComboBox1.ClientID %>");
but the ("<%="s cause errors in my application due to the web page being dynamically built. I have also tried
var combo = $find(locationTypeDDID.value);
but this returns a null object, where as document.getElementById(locationTypeDDID.value) does return the combo box object.
Thanks in advance for your help!
7 Answers, 1 is accepted


Please try this:
locationTypeDD = document.getElementById("locationTypeDDID"); |
var combo = $find(locationTypeDD.value); |
if (combo) combo.disable(); |
I hope this helps.
Kind regards,
Veselin Vasilev
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.

function
disableLocationTypeDD()
{
var locationTypeDDID = document.getElementById("hiddenLocationDDID");
if(locationTypeDDID != null)
{
var
combo = $find(locationTypeDDID.value);
if (combo) combo.disable();
}
}
where html is:
<
html xmlns="http://www.w3.org/1999/xhtml" >
<
head runat="server">
</
head>
<
body onload="disableLocationTypeDD()">
<form runat="server">
<telerik:RadComboBox ID="locationTypeDD" runat="server" EnableEmbeddedSkins="False">
<
CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
</
telerik:RadComboBox>
<
asp:HiddenField ID="hiddenLocationDDID" runat="server" />
</form></body></html>
and in the code behind page I set the Client ID of locationTypeDD into hiddenLocationTypeRestrictDDID
I believe we are getting closer.
The problem is that in the body load method the javascript objects are still not initialized and that is why the combo object is null.
You need to call your function in the pageLoad() (fired after the Sys.load event) event where all the scripts are loaded and the objects are created and initialized.
I hope this helps.
Sincerely yours,
Veselin Vasilev
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.

pageLoad is a shortcut for the Sys.Application.load event. For details on the matter please refer to the following ASP.NET article.
Greetings,
Paul
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.