Hi,
I have a gridview with dropdown control. I need to save dropdown selected value to another sharepoint list's Lookup column field.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Brijendra GautamPosted Mar 14, 2014, 4:44 AM
foreach (GridViewRow gr in spGrid.Rows)
{
DropDownList ddlLookup = (DropDownList)gr.FindControl("ddlLookup");
SPListItem listItem = splist.Items.Add();
SPFieldLookupValue lookup = new SPFieldLookupValue(Convert.ToInt32( ddlLookup.SelectedItem.Value), ddlLookup.SelectedItem.Text);
listItem["lookup"] = lookup;
listItem.Update();
}