Raj Raj -4 years ago 194
C# Question

The type or namespace name 'SelectListItem' could not be found, MVC3

I am trying to fill the dropdownlist from the database,

I am following this link

I have written the following code in the model

public class FillDeptName
{
public IList<SelectListItem> Drp_Name { get; set; }
}


I am getting the following error message:


The type or namespace name 'SelectListItem' could not be found (are
you missing a using directive or an assembly reference?)

Answer Source

You are missing on top of your code:

using System.Web.Mvc;

http://msdn.microsoft.com/en-us/library/system.web.mvc.selectlistitem(v=vs.118).aspx

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download