Sunday, 15 April 2018

How to bind Dropdown list with hard code values in MVC

In my previous blogs, you can read about MVC.
In this blog, we will see how to bind @Html.DropDownList with static values.

Bind Static values with a Dropdown list in MVC

Below is the code to bind Dropdownlist in MVC with static values.

<div class="form-group">
 @Html.DropDownList("--Select--", new List<SelectListItem>
new SelectListItem{ Text="MVC", Value = "MVC" },
new SelectListItem{ Text="WCF", Value = "WCF" },
new SelectListItem{ Text="Web API", Value = "API" }

Keep your eyes on SharePointCafe.Net for upcoming MVC blogs

You may like few blogs on MVC-

Disqus Comments