3

I have two lists List1 and List2. I have written code to update List2 item from ItemUpdating event of List1. This should fire ItemUpdated event of List2 but it does not. Below is the code I used to update List2 item.

var list = web.Lists["List2"];    
var item = list.GetItemById(Id);

item["City"] = "CityA";
item.Update();

List2 events fires when there is manual update in list but only failing in above case. What am I missing here?

  • 1
    You're not doing a web.EventFiringEnabled = false anywhere are you? – Submits Nov 27 '15 at 10:08
  • Yes i've written this statement but it is for List1. Is it affecting List2 from firing its events? – Ashish Nov 27 '15 at 10:21
1

You've stated that you're doing a web.EventFiringEnabled = false in the event receiver for List1.

This will disable event firing across your entire web, including for List2. This explains why your event receiver for List2 is not firing.

  • Thanks. I did not know that base.EventFiringEnabled will affect entire site collection. I think I will have to improve my code in order to prevent list item from firing ItemUpdated event. – Ashish Nov 27 '15 at 11:23

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.