Monday, July 25, 2011

fill dropdown list programatically from choice column in sharepoint

public void FillDropDownListChoice(SPList list, DropDownList drpList, string columnName)
        {
            try
            {
                SPFieldChoice field = (SPFieldChoice)list.Fields[columnName];
                drpList.DataSource = field.Choices;
                drpList.DataBind();
                if (columnName == Constants.FIELD_Language)
                    drpList.SelectedValue = "English";
            }
            catch (Exception ex)
            {
                logError("Error:In Filling Dropdown choice-" + drpList + ":", ex);
            }
        }

No comments:

Post a Comment

SharePoint document metadata not updating

I faced a weird issue today, Metadata for document which has lookup column was not updating even after saving the item. There was no erro...