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

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -