@model HelloWorldMvcApp.SampleViewModel
ViewBag.Title = "GetData";
var items = new List<SelectListItem>();
for (int i = 1; i < 6; i++)
var selectlistItem = new SelectListItem();
selectlistItem.Text = (code + i).ToString();
selectlistItem.Value = (code + i).ToString();
items.Add(selectlistItem);
@using (Html.BeginForm("PostData","Home"))
<div class="form-horizontal">
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
@Html.LabelFor(model => model.WaitTime, htmlAttributes: new { @class = "control-label col-md-2" })
@Html.DropDownListFor(model => model.WaitTime, items, "--Select--", new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.WaitTime, "", new { @class = "text-danger" })
@Html.LabelFor(model => model.Attentive, htmlAttributes: new { @class = "control-label col-md-2" })
@Html.DropDownListFor(model => model.Attentive, items, "--Select--", new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Attentive, "", new { @class = "text-danger" })
@Html.LabelFor(model => model.Outcome, htmlAttributes: new { @class = "control-label col-md-2" })
@Html.DropDownListFor(model => model.Outcome, items, "--Select--", new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Outcome, "", new { @class = "text-danger" })
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Create" class="btn btn-default" />