Hi Expert,
I want to change way of create dropdown menu in my razor view.
Here is my code:
<div class="col-md-6">
@{
List<SelectListItem> listItems = new List<SelectListItem>();
listItems.Add(new SelectListItem { Text = "Approved", Value = "A" });
listItems.Add(new SelectListItem { Text = "Pending", Value = "P", Selected = true });
listItems.Add(new SelectListItem { Text = "Rejected", Value = "R" });
}
<label for="status">Status</label>
@Html.DropDownListFor(model => model.Status, listItems, "-- Select Status --", new { @class = "form-control" })
</div>
Please give me some solution to achieve this task.
Hemant Patel
14-Dec-2017Hi Aarav,
I analyzed your code. You can also create static dropdown in your razor view with different manner.
Please follow below line of code.
Hope its helpful!!!!