Question

i trying to use DropDownList in code behind but i get an error - the visual studio dont recognized the dropdownlist. enter image description here

I was trying to put the "System.Web.UI.WebControls.DropDownList" statment but nothing changed.

This is my current statment:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.SqlClient;
using System.Web.Configuration;
using System.Text;
using System.Configuration;
Was it helpful?

Solution

You are missing these two namespaces using System.Web.UI; using System.Web.UI.WebControls; if you are using ASP.NET try this code hope it will help.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public void loadSuppliers(DropDownList ddl)
{

}

OTHER TIPS

Add namespace below

using System.Web.UI.WebControls;

If this still does not work ,try rebuilding the project. In Visual Studio , go to Build menu and select Rebuild option.

You need to add one namespace

using System.Web.UI.WebControls;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top