In Controller
public ActionResult SelectCountry() {
List<selectlistitem> items = new List<selectlistitem>();
items.Add(new SelectListItem { Text = "India", Value = "0",Selected = true});
items.Add(new SelectListItem { Text = "Nepal", Value = "1" });
ViewBag.Country = items;
return View();
}
</selectlistitem></selectlistitem>
In View
@Html.DropDownList("Country")
For Your Application You can Use Like
public List<selectlistitem> Gender
{
get
{
List<selectlistitem> items = new List<selectlistitem>();
items.Add(new SelectListItem { Text = "Male", Value = "2",Selected = true});
items.Add(new SelectListItem { Text = "Female", Value = "2" });
return items;
}
}
Its May Suit for you !
Thanks