This is a migrated thread and some comments may be shown as answers.
Hide/Show depending on checkbox
2 Answers 28 Views
This is a migrated thread and some comments may be shown as answers.
Elliott
Top achievements
Rank 2
Elliott asked on 19 Feb 2013, 05:53 PM
I'd like to implement the following, on the client if at all possible

a user control has a checkbox and a dropdown
it loads with the checkbox unchecked and the dropdown hidden
if the user checks the checkbox the dropdown becomes visible
if the user unchecks the checkbox the dropdown becomes hidden

sounds so simple, right?
any assistance is appreciated

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 1
answered on 20 Feb 2013, 05:21 AM
Hi Marianne,

Try the following markup and JS to achieve your scenario
aspx:
<asp:CheckBox ID="CheckBox1" runat="server" onclick="OnCheckedChanged(this)" />
<telerik:RadComboBox ID="RadComboBox1" runat="server">
    <Items>
        <telerik:RadComboBoxItem Text="001" />
        <telerik:RadComboBoxItem Text="002" />
        <telerik:RadComboBoxItem Text="003" />
    </Items>
</telerik:RadComboBox>
JS:
<script type="text/javascript">
function OnCheckedChanged(sender)
{
 
if (sender.checked == true)
    {
        var combo = document.getElementById('<%= RadComboBox1.ClientID %>').disabled = true;
    }
else
    {
        var combo = document.getElementById('<%= RadComboBox1.ClientID %>').disabled = false;
    }
 
}
</script>

Thanks,
Princy
0
Elliott
Top achievements
Rank 2
answered on 20 Feb 2013, 01:48 PM
thanks!

I was getting bollixed up because onchange doesn't get raised in IE8
Asked by
Elliott
Top achievements
Rank 2
Answers by
Princy
Top achievements
Rank 1
Elliott
Top achievements
Rank 2
Share this question
or