Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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
share|improve this question
add comment

3 Answers

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.

share|improve this answer
    
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/… –  Anders Rask May 4 '10 at 20:57
add comment

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

share|improve this answer
    
That event is also asynchronous. Check out this page (moss2007.be/blogs/vandest/archive/2008/03/21/…) for more information. –  MBSurf May 4 '10 at 20:13
    
please use "add comment" to a given answer to comment on a given answer instead of creating a new answer :-) –  Anders Rask May 4 '10 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 '10 at 21:34
add comment

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.