Hi,
I wanted 2 bind list field value to dropdownlist.For that i have used below code in page load.Employee is listname and Ename is the list field name.
if (!Page.IsPostBack)
{
using (SPSite site = new SPSite("http://sharepoint-pc:54673/sample/"))
{
using (SPWeb web = site.OpenWeb())
{
SPList list = web.Lists["Employee"];
DropDownList2.DataSource = list.Items;
DropDownList2.DataValueField = "Ename";
DropDownList2.DataTextField = "Ename";
DropDownList2.DataBind();
}
}
}
bit i got the following exception
DataBinding: 'Microsoft.SharePoint.SPListItem' does not contain a property with the name 'Ename'. Plz help me where is the problem.Thanks in advance.
regards
Praveen