Enable RadButton when item from RadCombobox is selected

2 posts, 0 answers
  1. Darrin
    Darrin avatar
    3 posts
    Member since:
    Nov 2015

    Posted 04 Aug Link to this post

    I have a radbutton on my form that is disabled.

    I have about 10 RadComboboxes on the same form.

    I'm trying to enable the Radbutton once a Value is selected from the any of the comboboxes.

    Can't seem to get this working.

    Any help would be appreciated.

     

    <telerik:RadComboBox ID="ddl1" runat="server" Width="90px" Skin="Vista" Font-Names="Verdana" Font-Size="Small" ZIndex="8900" OnClientDropDownOpening="Enable_Save">
                            </telerik:RadComboBox>

     

    <script type='text/javascript'>
    function Enable_Save()
    {
        if(document.getElementById("ddl1").value!="")
            document.getElementById("b1").disabled=false;
        else
        document.getElementById("b1").disabled=true;

    }

    </script>

     

     

  2. Ivan Danchev
    Admin
    Ivan Danchev avatar
    832 posts

    Posted 08 Aug Link to this post

    Hello Darrin,

    Instead of using OnClientDropDownOpening subscribe the ComboBoxes to the OnClientSelectedIndexChanged event:
    <telerik:RadComboBox ID="RadComboBox1" runat="server" OnClientSelectedIndexChanged="OnClientSelectedIndexChanged">
    </telerik:RadComboBox>

    in the event's handler get the button and call its set_enabled() client-side method passing true in order to enable it:
    function OnClientSelectedIndexChanged(sender, eventArgs) {
        var button = $find("<%=b1.ClientID %>");
        button.set_enabled(true);
    }



    Regards,
    Ivan Danchev
    Telerik by Progress
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top