You must Sign In to post a response.
  • Category: ASP.Net MVC

    What is the syntax to add dropdown list in MVC (NOT RAZOR)

    I add ck editor in MVC as:

    <%:Html.TextAreaFor(x => x.Text, new {id = "my-textarea", @class = "ckeditor" }) %>

    what is the syntax to add DROPDOWNLIST IN ASP.NET MVC( NOT RAZOR)
  • #762015
    Hello sp,

    You can refer the below code :

    <select id="User_State" name="User.State"><option value="0">Nirav</option>
    <option value="1">Sridhar</option>
    <option value="2">Kumar</option>

    @Html.DropDownListFor(model => model.User.State, new SelectList(
    new List<Object>{
    new { value = 0 , text = "Nirav" },
    new { value = 1 , text = "Sridhar" },
    new { value = 2 , text = "Kumar"}

    Hope this will help you.

    Nirav Lalan
    DNS Gold Member
    "Failure is the path of least persistence"

  • #762102

    For adding dropdownlist in mvc go through below links which shows you in different ways using collections and helper methods.


    Sridhar Thota.

    Sridhar Thota.
    Editor: DNS Forum.

Sign In to post your comments