views:

66

answers:

2
+2  Q: 

ASP Form problem

Hi I have an asp form that has a checkbox and dropdown menu. If the checkbox in not selected then I need to make sure the dropdown is either not selected or disabled.

+2  A: 

You either need to PostBack on a the check changed event or disable it using JavaScript

On your checkbox add onchange="checkChanged()"

Then you need to add the javascript function

function checkChanged()
{
    if(Document.GetElementById('mycheckBox').Checked)
        Document.GetElementById('myDropdown').disabled = true;
    else
         Document.GetElementById('myDropdown').disabled = false;
}
cgreeno
+2  A: 

You should make a javascript to check if the checkbox is checked or not, and then enable/disable the dropdown?
You can do this using jQuery, you need to wrap a function that gets called arround it:

if ($("#checkbox").attr("checked")) {
    $("#dropdown").attr("disabled", true);
}
else
{
    $("#dropdown").attr("disabled", false);
}
Frost