Search code examples
javascriptasp.netcomboboxtelerik

Enable/Disable Telerik asp.net combo box with dynamic ID from javascript


I am creating a web app in which I am using telerik components, I want to Enable/Disable the combobox from Javascript but the problem is my combobox is created during pageload, and I am not able to use the following code which I Get From telerik Q/A

var category = $find("<%= combo1.ClientID %>");
category.enable();

what is the possible way to enable disable components of telerik asp.net from javascript?


Solution

  • You can find different ways to obtain reference to the Telerik client-side object in this documentation article: https://docs.telerik.com/devtools/aspnet-ajax/general-information/get-client-side-reference.

    You can also use the OnClientLoad client event of combobox to get reference to its client object:

    <script>
    function OnClientLoadHandler(sender)   {
        var combo;
        combo=sender;
    }
    </script>
    
    <telerik:RadComboBox RenderMode="Lightweight" 
        ID="RadComboBox1" 
        runat="server" 
        OnClientLoad="OnClientLoadHandler" .../>