About Me

My photo
Muthupet, TamilNadu, India
SharePoint 2010

Sunday, December 2, 2012

Bind Sharepoint 2010 List items in DropDown



using (SPSite site = new SPSite(SPContext.Current.Site.Url))

{

using (SPWeb web = site.OpenWeb())

{

SPList list = web.Lists["Employee"];

dropSite.DataSource = list.Items.GetDataTable();

dropSite.DataValueField = "Company";

dropSite.DataTextField = "Company";

dropSite.DataBind();

}

}

No comments:

Post a Comment