private ListLoadDropDownList(SPList spList) { SPQuery quary = new SPQuery(); SPListItemCollection titleItems = spList.GetItems(quary); List howList = new List (); if (titleItems.Count>0) { foreach (SPListItem titleitem in titleItems) { howList.Add(titleitem["Title"].ToString()); } } else { howList.Add("No records to load"); } return howList; }
Then you can easyly assign that string type list to Dropdown “Data Source” as follows
howDropDownList.DataSource = LoadDropDownList(findOutlist); howDropDownList.DataBind();
thanks so much ,It's work fine for me
ReplyDelete