Drop Down List Enabled/Disabled

Sluggo

Newcomer
Joined
Apr 29, 2004
Messages
7
Hello All!

I have a drop down list which i want to make visible/invisible or enabled/disabled depending on the selected value in a radio button. Is this possible without performing a postback?

I know its fairly easy to do if I just do a postback to the server unfortunately performing a postback adds an extra trip to the server which I'm trying to avoid because of performance issues.


Thanks.
 
using javascript

to disable:
document.Form1.dropdown1 = "none";

to enable:
document.Form1.dropdown1 = "";
 
Here's the script script I did. It still doesn't work.

function DisableShip()
{
if document.form1.rdbtnMoveInfo[0].checked
{
document.form1.ShipControl:DropDownVessel = "";
}
else
{
document.form1.ShipControl:DropDownVessel = "none";
}
}
</script>


Thanks
 
1. Please make sure your script is run. You may add a msg prompt to make sure your code is running
2. Javascript is case sensitive, for is it your "form1" correct or "Form1"? because VB.NET default give us "Form1" instead of "form1"
 
Hi bungpeng

I verified that the form1 is indeed "form1" in my aspx page. I get an error on my page whenever i access it. The error states that
Line: 20
Char: 34
Error: Expected ';'
Code: 0
 
It means your page get error.

OK, I found a error in your javascript code:
In javascript:
if document.form1.rdbtnMoveInfo[0].checked

should change to:
if (document.form1.rdbtnMoveInfo[0].checked)

I sure this is one of the error, but not sure whether there are any other errors, test it and see
 
Hi bungpeng!

i managed to remove the error when the page loads, however when i change the selection of the radio button, an error on the page again appears

The error is as follows:
Line: 24
Char: 5
Error: Object doesn't support this property or method.

Line 24 points to --> document.form1.VesselControl1_DropDownVessel = "none"


function DisableFields()
{
if (document.forms[0].rdbtnMoveInfo.value=="E")
{
document.form1.VesselControl1_DropDownVessel = ""
}
else
{
document.form1.VesselControl1_DropDownVessel = "none"
}
}
</script>

Thanks for the replies :)
 
Sorry, my mistaken. Add "disabled" property for dropdownlist control

document.form1.VesselControl1_DropDownVessel.disabled = ""
document.form1.VesselControl1_DropDownVessel.disabled = "none"
 
Back
Top