The following code enables us to read data from SPFieldChoice and load to DropDownList control
List<string> listItem = new List<string>();
SPWeb web = SPContext.Current.Web;
SPFieldChoice cfStatus = (SPFieldChoice)web.Lists["Employee"].Fields["Position"];
for (int i = 0; i < cfStatus.Choices.Count; i++)
{
string choiceValue = cfStatus.Choices[i].ToString();
listItem.Add(choiceValue);
}
ddl.DataSource = listItem;
ddl.DataBind();
Hope this helps!
Sunday, December 4, 2011
Read data from SPFieldChoice and load to DropDownList
9:37 PM
Unknown
No comments
0 comments:
Post a Comment