Link to home
Start Free TrialLog in
Avatar of RBS
RBS

asked on

State/Province/Country Issue MVC

Hi:

I have a website with clients from US and Canada.  I've updated the code to MVC and am trying to figure out how have the dropdown for provinces-states populated with the appropriate data depending on the country that was chosen.  

In my forms program, this is what fired when the Country dropdown box changed:

 private void PopulateState_Provinces(string Country_Code)
        {
            if (Country_Code == "US")
            {
                lblProvince.Text = "State:Country";
                lblPostalCode.Text = "Zip Code";
            }
            else
            {
                lblProvince.Text = "Province:Country";
                lblPostalCode.Text = "Postal Code";
            }


            DataTable dtProvinces = DataAccess.Provinces_GetAll(Country_Code);
            drpProv_Code.DataSource = dtProvinces;
            drpProv_Code.DataValueField = "Prov_Code";
            drpProv_Code.DataTextField = "ListName";
            drpProv_Code.DataBind();
        }

Open in new window


Any suggestions greatly appreciated!

RBS
ASKER CERTIFIED SOLUTION
Avatar of Mohit Vijay
Mohit Vijay
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of RBS
RBS

ASKER

Thanks,

RBS