This is a migrated thread and some comments may be shown as answers.

RadNumericTextBox and asp:DropDownList

1 Answer 28 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Borislava
Top achievements
Rank 1
Borislava asked on 05 Dec 2013, 04:51 PM
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?

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 06 Dec 2013, 02:56 AM
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.
Tags
General Discussions
Asked by
Borislava
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or