2

Event handler ItemAdded is working. However, the site does not refresh right away. I am populating some column when an item is added.

The column shows up fine but it is empty. If I refresh (or hit F5) then data shows up with the item.

Any ideas?

I put this in the finally block but it's not refreshing the page as it only updates the backend database.

site.RootWeb.Update();  // not working
web.Update(); // not working

3 Answers 3

3

The ItemAdded event is asynchronous. When you post, the server is updating the item, sending a response to your browser, and kicking off ItemAdded handlers. Those handlers aren't finishing before the server sends the response.

Check out the ItemAdding event for a synchronous event.

1
  • In SP2010 you have synchronous after events. This is implemented as a Synchronization (SPEventReceiverSynchronization enumeration value) property on the SPEventReceiverDefinition base class. msdn.microsoft.com/en-us/library/… May 4, 2010 at 20:57
0

I am now using ItemUpdated and same issue... hmm.

3
  • That event is also asynchronous. Check out this page (moss2007.be/blogs/vandest/archive/2008/03/21/…) for more information.
    – MBSurf
    May 4, 2010 at 20:13
  • please use "add comment" to a given answer to comment on a given answer instead of creating a new answer :-) May 4, 2010 at 20:53
  • This issue remains to be unresolved. I am still open to ideas and the trick that will work for this scenario.
    – Anonymous
    May 7, 2010 at 21:34
0

Greg, I also face the same issue and then come to the following conclusion.

ItemAdded and Itemupdated are asynchronous events data updated or added in this events may be displayed some time or may not be displayed. To ensure that updated data displayed after the evet completion you need to user synchronous events i.e ItemAdding and ItemUpdating. After updation you need to call update method on listitem that you are updating, however in case of ItemAdding you need to set the value in like this

 properties.AfterProperties["your_column_internal_name"] = "value";

Values update during ItemUpdating or ItemAdding events will be reflected on result page immediately.

If there is still any confusion, please post your code here so that I can analyze you problem. Thanks, Asad Jahangir

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.