4
Reply

How to bind dropdownlistfor as List<string> ?

Mani Kandan

Mani Kandan

May 12 2017 4:51 AM
346
Hello all,
 
Thera the values of dropdownlistfor,
 
  1. public static List<string> incorporationtypelist = new List<string> { "Publicaly Held""Privately Held""Other" }; 
 And this is the text of the dropdownlistfor,
 
  1. "Public" ,"Private","Others" 
 Then, How can bind both Text and Value to drowpdownfor?
 
  1. @Html.DropDownListFor(model => model.incorporationtypelist, new SelectList(Model.incorporationtypelist, "Value", "Text"), new { @class = "form-control" }) 
 Please help me...

Answers (4)