How to check for a disabled combobox in JavaScript

2 posts, 1 answers
  1. DonKitchen
    DonKitchen avatar
    104 posts
    Member since:
    Jul 2007

    Posted 20 Apr 2011 Link to this post

    I would like to know how I can check (via JavaScript) if a given combobox is enabled or not.  I see how to enable or disable it, but not how to check the status.
  2. Answer
    Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 20 Apr 2011 Link to this post

    Hello Don,

    The RadComboBox provides a flexible client-side API. You can easily interact with the combobox in the browser using the combobox client-side object. The client side method  get_enabled() checks whether the object is enable or disabled.

    Here is a sample code:
    aspx:
         <telerik:RadComboBox  ID="RadComboBox1" Enabled="false"
                runat="server">
                <Items>
                    <telerik:RadComboBoxItem runat="server" Text="No Postback Item 1" />
                    <telerik:RadComboBoxItem runat="server" Text="Do postback Item 1" />
                    <telerik:RadComboBoxItem runat="server" Text="No postback Item 2" />
                    <telerik:RadComboBoxItem runat="server" Text="Do postback Item 2" />
                </Items>
    </telerik:RadComboBox>
     <asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="Check();" />

    Javascript:
    function Check()
        {
           var combo = $find('<%=RadComboBox1.ClientID%>');
           alert(combo.get_enabled());
       }

    Thanks,
    Shinu.
Back to Top