I am working in Address.aspx.cs and have an issue when trying to hide a specific field. I am using "CountyDropDownData(ctrlAddress)" to pull counties into a drop down box.
I have been trying to have the ctrlAddress.ShowCounty be true if OH is the selected state. The only problem is that I put an if statement in the ctrlAddress_SelectedStateChanged:
Code:
if (ctrlAddress.State == "OH" && ctrlAddress.Country == "United States")
{
ctrlAddress.ShowCounty = true;
}
else
{
ctrlAddress.ShowCounty = false;
}
If the page loads and the selected state is OH, my script works fine, but when I change to another state, and clickout for the postback, and then choose Ohio, the field shows, but it's not populated. It's like the datasource isn't known. I have tried putting "CountyDropDownData(ctrlAddress);" in the selectedstatechanged event but that does nothing.
Currently, the state has to be saved in the db as OH for the drop down to work properly. Any ideas?