0

I am a new user to mvc 3. I read this article to develop mvc module. Now I want to add other controls instead of text box. E.g. when I wish to add details in movie list.

A dropdown for genre should appear

AnarchistGeek
  • 3,049
  • 6
  • 32
  • 47
pr1204
  • 11
  • And? What have you tried? What's not working? – Oded Feb 28 '12 at 13:39
  • i added a dropdown list in create.chtml
    @Html.DropDownList(model => model.Title) @Html.ValidationMessageFor(model => model.Title)
    – pr1204 Feb 28 '12 at 13:40
  • So, why not post these details, including the error? – Oded Feb 28 '12 at 13:42
  • This will help you. Please check this. http://stackoverflow.com/questions/5326515/create-a-dropdown-list-for-mvc3-using-entity-framework-edmx-model-razor-vie – TRR Feb 28 '12 at 13:44

1 Answers1

0

ASP.NET MVC isn't quite like WebForms in that there's a set of server controls all ready and waiting for you to "Drag and Drop" them in your page.

In ASP.NET MVC you typically use the HTML elements as controls (often times with HtmlHelpers). For instance, if you wanted a "dropdown for genre", you'd do something like:

<select>
  <option value="genre1">Genre1</option>
  <option value="genre2">Genre2</option>
</select> 

Or, to generate this with an HtmlHelper, you'd do something like:

@Html.DropDownListFor(m => m.YourModelProperty, YourSelectList)