I am using ItemUpdating Event for recording changes in List Item.

  item["RequestType"].ToString().ToUpper() !=properties.AfterProperties["RequestType"].ToString().ToUpper()

RequestType field is lookup field and it holding values as drop down.

Ex: RequestType field containing two option values. i.e. Application and Desktop.

item["RequestType"].ToString() shows "1;#Apllication" and in Item Updating i didn't change any thing but

properties.AfterProperties["RequestType"].ToString() showing "1" value.

What is the problem in my code.

Please suggest me about this error.

I am using SharePoint 2010.


Instead of try to fetch the lookFieldValue from afterproperties, fetch the LookupID from current lookupfield value and compare it with afterproperties.

The reason why we are not able to fetch the lookfieldValue from afterproperties is the afterproperties only return the lookupID, whereas we require the string of the format lookupID#lookUpValue to fetch the lookupfieldValue.

var prevLookup = new SPFieldLookupValue(item["RequestType"].ToString());
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.