Monday, February 8, 2010

Bind dropdown list with sharepoint choice column as data source programmatically

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)
SPFieldChoice field = (SPFieldChoice)list.Fields[columnName];
drpList.DataSource = field.Choices;
catch (Exception ex)

No comments: