且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

ListItemEventHandler does not fire on the prospective list

更新时间:2022-08-12 21:29:18

Today I met a problem. I have several list definition in my project. I attached ListItemEventHandler to every list. Every List inherits from Custom List. I deploy the solution and create a Custom List on the deployed site. When I add an item to the Custom List, every eventhandler fire. I don't know what caused this and I didn't find the reason. After I recreate features, it works.

 

ListItem的事件接收器没有在预期的列表上触发

 

今天我遇到了一个问题。在我的工程里有几个列表定义,我在每个列表上添加了ListItem的事件接收器。每个列表定义都继承自自定义列表。我把解决方案部署之后,在目标站点上创建了一个自定义列表。当我向自定义列表里添加项目的时候,每个事件接收器都被触发了。我不知道什么造成了这个问题,没有找到原因。当我重建功能之后,它如期望地运行了。

 

Update: The reason is the feature's scope is site. I changed the socpe to web and it works.

 

更新:原因找到了,是因为功能的范围设置成了Site,改为Web就可以了。