如何设置Lookup字段的值, 首先我们同样需要了解SPFieldLookupValueCollection和SPFieldLookupValue, 这2个类的原理和之前所讲解到SPFieldUserValueCollection一样,这里就不多讲解
/// <summary>
/// Convert dropdownList value to SPFieldLookupValue
/// </summary>
/// <param name="dropdownList">DropDownList Control</param>
/// <returns>SPFieldLookupValue</returns>
private SPFieldLookupValue setLookupValue(DropDownList dropdownList)
{
SPFieldLookupValue lookupValue = new SPFieldLookupValue(Convert.ToInt32(dropdownList.SelectedItem.Value), dropdownList.SelectedItem.Text);
return lookupValue;
}