I've bound and ItemUpdating event to a document library of a MOSS publishing site, I’m then trying to compare the Before and After properties.
When I amend the field in the UI I expect the two values to be different, however they are always the same - by that I mean the original value. AfterProperties does not hold the new value.
This is the code I am using…
string internalName = properties.ListItem.Fields["SchemeProvider"].InternalName;
string BeforeValue = properties.BeforeProperties[internalName]);
string AfterValue = properties.AfterProperties[internalName]);
if (BeforeValue != AfterValue)
{
properties.cancel = true;
properties.ErrorMessage = “you cannot change this field value”;
}
What I don’t understand is that the ItemUpdated Before and After Properties are correct, in that the values are different.