Easy way to populate the dropdown list with databind option instead of looping the items in list for Choice column.
private void FillDropDownList(SPList list , DropDownList drpList , string columnName)
{
try
{
SPFieldChoice field = (SPFieldChoice)list.Fields[columnName];
drpList.DataSource = field.Choices;
drpList.DataBind();
}
catch (Exception ex)
{}
}
No comments:
Post a Comment