Monday 25 March 2013

Error while updating look up columns programmatically in SharePoint

error- Invalid data has been used to update the list item. The field you are trying to update may be read only.
Resolution :--


SPFieldLookupValue value = new SPFieldLookupValue(Convert.ToInt32(ddlTest.SelectedValue), ddlTest.SelectedItem.Text);
itemToAdd["ColumnName"] = value;

Where ddlTest  is a dropdown and dropdown value contains the id of the column and dropdown text contains the text of the column of the parent list.

No comments:

Post a Comment