4
Answers

How to bind dropdownlistfor as List<string> ?

Mani Kandan

Mani Kandan

7y
365
1
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)