SharePoint Blog - René Hézser

Anmelden  RSS Feed RSS Feed
Startet die Suche

Archive

Kategorien

Links

Andere Blogs




ITaCS GmbH


How to get LookupField Information from a listItem  

Jun 232007

If you want the ID or the value form a LookupField, you can get it easily with this code snippet:

SPListItem item = getitsomewhare...
SPFieldLookupValue lf =
    (SPFieldLookupValue)
     item.ParentList.Fields.GetField(_FieldName).GetFieldValue(
     item.GetFormattedValue(_FieldName));

if you got the field, fetch its properties via

if (lf == null)
{
    int itemID = lf.LookupId;
    string itemValue = lf.LookupValue;
}
Have fun ;-)
 
Posted by René Hézser | 0  Comments | Trackback Url  | 0  Links to this post | Bookmark this post with:        
Tags: Development, SharePoint, SPField
Technorati Tags: , ,

Links to this post

Comments

Name *:
URL:
Email:
Kommentar:


CAPTCHA Image Validation