Help Needed
-
Hi, I have two dropdown list control, one has all the country values (USA,India,Japan etc.,) and another dropdown list control has a value of states ( CA,MA,WA,MD etc.,). i have one textbox to enter states name for non USA. if i select country as USA then the state dropdown list control should be enabled and the txtbox should be diabled. if i select country as othen then USA the state dropdown list control should be disabled and the txtbox should be enabled. how to achive this can anyone help Thanks Perumal Sethuraman
-
Hi, I have two dropdown list control, one has all the country values (USA,India,Japan etc.,) and another dropdown list control has a value of states ( CA,MA,WA,MD etc.,). i have one textbox to enter states name for non USA. if i select country as USA then the state dropdown list control should be enabled and the txtbox should be diabled. if i select country as othen then USA the state dropdown list control should be disabled and the txtbox should be enabled. how to achive this can anyone help Thanks Perumal Sethuraman
Private Sub DropDownList1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged DropDownList2.Enabled = False TextBox1.Enabled = False End Sub take it easy;) --junior coder--
-
Hi, I have two dropdown list control, one has all the country values (USA,India,Japan etc.,) and another dropdown list control has a value of states ( CA,MA,WA,MD etc.,). i have one textbox to enter states name for non USA. if i select country as USA then the state dropdown list control should be enabled and the txtbox should be diabled. if i select country as othen then USA the state dropdown list control should be disabled and the txtbox should be enabled. how to achive this can anyone help Thanks Perumal Sethuraman
You can do that with some scripts on the client side. What you need to do is to add some scripts to enable/disable the state dropdownlist and textbox controls when the onchange event of the country dropdownlist is raised.
function Country_Changed()
{
var country = window.document.getElementById("ddlCountry").value;
if(country=="")
{
window.document.getElementById("ddlState").disabled = "disabled";
window.document.getElementById("txtState").disabled = "disabled";
}
else if(country=="USA")
{
window.document.getElementById("ddlState").disabled = "";
window.document.getElementById("txtState").disabled = "disabled";
}
else
{
window.document.getElementById("ddlState").disabled = "disabled";
window.document.getElementById("txtState").disabled = "";
}
}To register the Country_Changed function for the onchange event, you can use the sample code below:
ddlCountry.Attributes.Add("onchange", "Country_Changed();");
In addition, you can also use some code on the server side to do that, but I think it is unlikely.
-
Hi, I have two dropdown list control, one has all the country values (USA,India,Japan etc.,) and another dropdown list control has a value of states ( CA,MA,WA,MD etc.,). i have one textbox to enter states name for non USA. if i select country as USA then the state dropdown list control should be enabled and the txtbox should be diabled. if i select country as othen then USA the state dropdown list control should be disabled and the txtbox should be enabled. how to achive this can anyone help Thanks Perumal Sethuraman