Hello everyone,
I want to please know how I could do a dropdown list in ASP.NET that automatically includes all countries. I know how to make a simple drop-down list in asp.net, but it would be exhausting to have to fill by myself all over the world.
Should I do an import?
Please help.
VulpesPosted Dec 11, 2014, 6:43 AM
http://msdn.microsoft.com/en-us/library/system.web.mvc.controllerbase.viewbag(v=vs.118).aspx
ViewBag is a dynamic object whose properties you can define yourself. So we should be able to give it a Countries property and then retrieve the value of that property in the view.
Just wondering whether you have the controller code in the right place?
According to the above link, the whole method should be:
Ramsès Zogning IIPosted Dec 11, 2014, 6:00 PM
I finally get out.
The error was in another code for my controller, so the code you have given me is good. you are a champion. I could also connect the list of countries to one of my model table and everything works well.
Please, can you also help me about this:
Internationalization of a web application VCM 4 razor.
link:
http://www.c-sharpcorner.com/Forums/Thread/278453/internationalization-of-a-web-application-vcm-4-razor.aspx
thank you
Ramsès Zogning IIPosted Dec 11, 2014, 6:07 AM
This is the error : Il n'y a aucun élément ViewData de type « IEnumerable
thk u very much for your help Sirs
i will continue to fine the solution
Ramsès Zogning IIPosted Dec 11, 2014, 5:49 AM
i try after the school and i will tell you
VulpesPosted Dec 10, 2014, 5:52 PM
Frankly, I don't know a great deal about the latter but, after studying an example of populating a DropDownList I found on the internet (http://forums.asp.net/t/1959753.aspx?Best+way+to+populate+drop+down+lists+MVC+4+razor+) , I hope the following will work:
Ramsès Zogning IIPosted Dec 9, 2014, 5:23 PM
Ramsès Zogning IIPosted Dec 9, 2014, 5:21 PM
VulpesPosted Dec 9, 2014, 2:17 PM
To bind to the DDL, you'd then need something like this:
Joginder BangerPosted Dec 9, 2014, 2:12 PM
if you want region info select any list , then you make a event the selectedIndexed_changed.
Ramsès Zogning IIPosted Dec 9, 2014, 1:06 PM
How can i join RegionInfo to my dropdownlist ?
VulpesPosted Dec 9, 2014, 11:08 AM
http://justinchronicles.wordpress.com/2012/03/15/how-to-get-list-of-countries-defined-in-iso-3166-1-programatically-by-c-shar/
It should then be just a matter of binding this list to your DropDownList control.