Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

State/Province/Country Issue MVC

Posted on 2013-11-28
2
293 Views
Last Modified: 2013-11-30
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
0
Comment
Question by:RBS
2 Comments
 
LVL 8

Accepted Solution

by:
Mohit Vijay earned 500 total points
ID: 39684125
You have to create selectList (that is in MVC)

SelectList selectList = new SelectList(selectListItems, "Value", "Text");

http://www.jimmycollins.org/blog/?p=349
0
 

Author Closing Comment

by:RBS
ID: 39687748
Thanks,

RBS
0

Featured Post

The New “Normal” in Modern Enterprise Operations

DevOps for the modern enterprise offers many benefits — increased agility, productivity, and more, but digital transformation isn’t easy, especially if you’re not addressing the right issues. Register for the webinar to dive into the “new normal” for enterprise modern ops.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Flash (http://en.wikipedia.org/wiki/Adobe_Flash) has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question