How to bind Static Data to DropDownList in Asp.Net MVC with c#

@model MySample.Models.EmployeeDepartment

@{
ViewData.Name="GSV"
}
< H1>GSV</H1>

@using(Html.BeginForm())
{
@Html.AntiForeignKeyToken()

@Html.ValidationSummary()

< div>
@Html.Label("Select Employee",new {@class="from-contol"})

< div class="form-group">
@Html.DropDownListFor  (m=>m.EmployeeId,new List<SelectListItem>(){
new SelectListItem(){Text="One",Value=1},
new SelectListItem(){Text="Two",Value=2},
new SelectListItem(){Text="Three",Value=3},
new SelectListItem(){Text="Four",Value=4},
},new {@class="form-control"})
< /div>
< /div>

}

Comments

Popular posts from this blog

Reverse Sentence using c#

How to write Pure java script Program?