Discussion:
itemupdating event receiver issue
(too old to reply)
Stu
2010-04-29 20:08:12 UTC
Permalink
Hi all, I have an issue that I can't seem to get my head around - some help
would be appreciated!

So all I am trying to do for the moment is query three fields with an event
receiver.
The receiver is tied to a list on the itemupdating() event.
The code is below and all fields have existing values in them.
The ER should simply return the values in the fields and cancel the update.
It does correctly cancel the update, and displays the 'error' page so there
is no bug in the code, but it does not display the value within either field
(it displays "" // "")
Can anyone see what might be going on here?

-----

public override void ItemUpdating(SPItemEventProperties properties){

properties.ErrorMessage =
properties.AfterProperties["Actual_x0020_Award_x0020_Quarter"] + " // " +
properties.AfterProperties["Actual_x0020_Award_x0020_Date"];

DisableEventFiring();

properties.Cancel = true;
properties.Status =
SPEventReceiverStatus.CancelWithError;

EnableEventFiring();
}
James E
2010-05-21 15:58:01 UTC
Permalink
Stu,

Have you tried using the .ToString() method on your two calls to
AfterProperties[] ?

James
Post by Stu
Hi all, I have an issue that I can't seem to get my head around - some help
would be appreciated!
So all I am trying to do for the moment is query three fields with an event
receiver.
The receiver is tied to a list on the itemupdating() event.
The code is below and all fields have existing values in them.
The ER should simply return the values in the fields and cancel the update.
It does correctly cancel the update, and displays the 'error' page so there
is no bug in the code, but it does not display the value within either field
(it displays "" // "")
Can anyone see what might be going on here?
-----
public override void ItemUpdating(SPItemEventProperties properties){
properties.ErrorMessage =
properties.AfterProperties["Actual_x0020_Award_x0020_Quarter"] + " // " +
properties.AfterProperties["Actual_x0020_Award_x0020_Date"];
DisableEventFiring();
properties.Cancel = true;
properties.Status =
SPEventReceiverStatus.CancelWithError;
EnableEventFiring();
}
Loading...