You have to pass list to dropdown but here you are passing CustID and that is Integer. This is causing error.
Try following code:
1) Create a list with your items.
@{
List<SelectListItem> CustIDlistItems= new List<SelectListItem>();
CustIDlistItems.Add(new SelectListItem
{
Text = "text1",
Value = "value1"
});
CustIDlistItems.Add(new SelectListItem
{
Text = "text2",
Value = "value2",
Selected = true
});
CustIDlistItems.Add(new SelectListItem
{
Text = "text3",
Value = "value3"
});
}
2) Pass newly created list to view with list as a parameter.
@Html.DropDownListFor(model => model.Yourproperty, CustIDlistItems, "-- Select Status --")
Hope this will help you..!
EDIT :
You can utilize following example for creating dynamic list from database.
public IEnumerable<SelectListItem> GetTrainingSubjectsList(int selectedValue)
{
List<SelectListItem> TrainingSubjectsList = new List<SelectListItem>();
TrainingSubjectsList.Add(new SelectListItem() { Selected = true, Text = "Select Subject", Value = "" });
var TrainingSubjects = (from subjects in _context.TrainingDetails.Where(c => c.IsDeleted == false)
select subjects).ToList();
foreach (TrainingDetail TrainingDetail in TrainingSubjects)
{
SelectListItem Item = new SelectListItem();
Item.Text = TrainingDetail.Title;
Item.Value = TrainingDetail.TrainingDetailId.ToString();
if (selectedValue == TrainingDetail.TrainingDetailId)
{
Item.Selected = true;
}
TrainingSubjectsList.Add(Item);
}
return TrainingSubjectsList;
}