RadNumericTextBox and asp:DropDownList

2 posts, 0 answers
  1. Borislava
    Borislava avatar
    15 posts
    Member since:
    Oct 2012

    Posted 05 Dec 2013 Link to this post

    I have RadNumericTextBox and asp:DropDownList. How can I implement the following:
    If RadNumericTextBox.value empty or 0 set asp:DropDownList enable=true
    else asp:DropDownList enable=false without postback?

  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 05 Dec 2013 Link to this post

    Hi Borislava,

    Please have a look into the following code snippet to Enable/Disable the DropDownList based on the value of RadNumericTextBox.

    ASPX:
    <telerik:RadNumericTextBox ID="RadNumericTextBox1" runat="server" ClientEvents-OnValueChanged="OnValueChanged">
    </telerik:RadNumericTextBox>
    <asp:DropDownList ID="DropDownList1" runat="server">
        <asp:ListItem Text="Item1">
        </asp:ListItem>
        <asp:ListItem Text="Item2">
        </asp:ListItem>
    </asp:DropDownList>

    JavaScript:
    <script type="text/javascript">
        function OnValueChanged(sender, args) {
            if (args.get_newValue() != "0") {
                var dropdownlist = document.getElementById("DropDownList1");
                dropdownlist.disabled = true;
            }
        }
    </script>

    Thanks,
    Shinu.
Back to Top