Interview Questions administrator

Best SharePoint administrator Interview Questions and Answers with topic wise:


Recycle Bin | MMS | ManagedVsCrawledProperties |

Thursday, July 5, 2012

Bind lookup field data to the dropdownlist

Below code will help you to bind the lookup field data to the dropdown list.
if (spListItem["LookupField"] != null)
{
  SPFieldLookupValue spv = new   
  SPFieldLookupValue(spListItem["LookupField"].ToString());
  string lookupValue = spv.LookupValue;
  dropdownlist1.SelectedIndex = spv.LookupId;
 }

 To bind field values to the dropdownlist:

dropdownlist1.SelectedValue = spListItem["Field1"].ToString();

1 comment:

  1. WOW just what I was looking for. Came here by searching for bd web searh
    Look at my blog : local searh engine

    ReplyDelete