Skip to content
Loading
  • Manas Mohapatra
    +1
    Try like below 
    1. @model List<string>  
    2. @Html.DropDownList(  
    3.     "Foo",   
    4.     new SelectList(  
    5.         Model.Select(x => new { Value = x, Text = x }),  
    6.         "Value",  
    7.         "Text"  
    8.     )  
    9. )  
     
    +1
  • Shubham Kumar
    +1
    1. public SelectList incorporationtype()  
    2.        {  
    3.            return new SelectList(incorporationtypelist, "yourdatavaluefield", "yourdatatextfield");  
    4.   
    5.  

    6.      } 


    and in your view liske as
     
    1. @Html.DropDownListFor(model => model.AffilationType, (new .incorporationtype(),  
    2.                                             new { @id = "id", @class = "select form-control" }) 
     
    +1
  • Abhilash J A
    0
    @Manas Sir,
     
    Its okay, but How can I add both Text( that is:
    1. "Public" ,"Private","Others"   
    And Values (that is 
    1. "Publicaly Held", "Privately Held", "Other" 
    to this 'incorporationtypelist' list then after to dropdownlisfor ?
    0