Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?)

like image 911
Raj Avatar asked Dec 05 '22 07:12

Raj


2 Answers

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

like image 196
DmitryK Avatar answered Jan 10 '23 13:01

DmitryK


Import this namespace

using System.Web.Mvc;

FOR MORE

like image 37
Nitin Varpe Avatar answered Jan 10 '23 12:01

Nitin Varpe