Thursday 11 October 2012

Remove #;Id from lookup field in object model


 In Server side object model there will be  requirements  to display Multivalued lookupfield values,by  using direct the column value it will show you like 1;#value1;2;#value2 .To remove the special characters and the ID from the value use following :

SPFieldLookup filed1 = (SPFieldLookup)oSourceListItem.Fields["Column Name"];
 string value1 = filed1.GetFieldValueAsText(oSourceListItem["Column Name"]);
 itemToAdd["Column Name"] = value1;




1 comment:

  1. Whats up very cool website!! Man .. Beautiful .. Wonderful .
    . I will bookmark your blog and take the
    feeds additionally? I am happy to find so many useful info
    here within the put up, we'd like develop extra strategies in this regard, thanks for sharing. . . . . .

    Have a look at my weblog ... http://atlaslm.com

    ReplyDelete