In WSS V3 Lookup fields are made easier to code against.
Many of you WSS V2 developers will have come across the “1#;Some text” value that lookup fields return. Some of you will have added code to you own utility classes to parse them to give the ID and Field values. In WSS V3 it gets much easier out of the box with the introduction of the SPFieldLookupValue object which will provide the LookupId and LookupValue fields for you.
SPListItem task = SPContext.Current.ListItem;
SPFieldLookupValue lookup = new SPFieldLookupValue((string)task["FIELD NAME"]);
int id = lookup.LookupId;
string value = lookup.LookupValue;
This class SPFieldUserValue is also provided making it easy to get to the User information from User fields liked Created or Modified.
