asp.net mvc 3 - How to Bind Dictionary collection from Model to Dropdown List in razor view? -
plaese find blow code , suggest how bind collection list in drop down menu;
controller
public actionresult registation() { regisrationmodel register=new registerationmodel(); register.country=getcontrycode(); view(register); }
model:
public class registrationmodel{ dictionary<int,string> country=new dictionary<int,string>(); public dictionaly<int,string> getcountrycode() { county.add(1,"india"); country.add(2,"us"); on. } }
razorview:registation.cshtml-> can plese suggest how bind country property in razor view?
Comments
Post a Comment