To bind a databound WebControl (System.Web.UI.WebControls, etc.), you can use the following code:
DataSet ds = new DataSet(); SPSite myWeb = SPContext.GetContext(HttpContext.Current).Web; SPList list = myWeb.Lists["ListName"]; DataTable DTable_List = list.Items.GetDataTable(); DTable_List.TableName = "Table1"; ds.Tables.Add(DTable_List); DropDownBGroup.DataSource = ds.Tables["Table1"]; DropDownBGroup.DataTextField = "FieldName"; DropDownBGroup.DataValueField = "FieldName"; DropDownBGroup.DataBind(); DropDownBGroup.SelectedIndex = 0; myWeb.Dispose();
No user commented in " Binding a Databound WebControl to a SharePoint List "
Follow-up comment rss or Leave a TrackbackLeave A Reply