Hi nauna,
Check this example. Now please take its reference and correct your code.
Database
For this example I have used of Northwind database that you can download using the link given below.
Download Northwind Database
Model
public class DetailModel
{
public int Id { get; set; }
public List<SelectListItem> Country { get; set; }
}
Controller
public class HomeController : Controller
{
// GET: /Home/
public ActionResult Index()
{
DetailModel model = new DetailModel();
NorthwindEntities entities = new NorthwindEntities();
model.Country = (from country in entities.Employees
select new SelectListItem()
{
Text = country.Country,
Value = country.Country
}).Distinct().ToList();
return View(model);
}
}
View
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<_Populate_DropDownList_Linq.Models.DetailModel>" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Index</title>
</head>
<body>
<div><%:Html.DropDownListFor(m => m.Country, Model.Country, "Select", new { style = "width:150px;" })%></div>
</body>
</html>
Sceenshot