How to bind html dropdownlist with static items in mvc.

How to bind html dropdownlist with static items in mvc.

I am going to explain how to bind html dropdownlost with static items in mvc.This is simple way to bind dropdownlist with static data if data not coming from database.

 

Use below code to bind dropdownlist : –

@Html.DropDownList(“Status”, new List<SelectListItem>

{

new SelectListItem{ Text=”Process”, Value = “0” },

new SelectListItem{ Text=”Stop”, Value = “1” },

new SelectListItem{ Text=”Pending”, Value = “2” }

})

About the author

admin administrator

Leave a Reply