简体   繁体   English

Sharepoint-Web部件上的事件

[英]Sharepoint - Event(s) on web part edit

Question: 题:

Is it possible to execute code solely upon the editing/settings change of a web part (presumably via event listeners) and if so can someone link/provide an example? 是否可以仅在Web部件的编辑/设置更改时执行代码(大概是通过事件侦听器),如果可以,则有人可以链接/提供示例吗?

Background: 背景:

I'm developing web parts for Sharepoint (specifically 2007 in this instance). 我正在为Sharepoint开发Web部件(本例中为2007)。
Latest one includes a feature to specify the urls of pages and display their contents. 最新的一项功能是指定页面的网址并显示其内容。
This is working fine. 一切正常。
A further requirement is that if a page is specified/handled by the web part then it should be hidden from the normal navigation bar. 另一个要求是,如果网页是由Web部件指定/处理的,则应将其从常规导航栏中隐藏。
I have the code to do this but there is no way in hell that I want this called every time a user views the web part (ie not in the constructor, create child components or (pre)render), rather I want it done only when the settings are changed. 我有执行此操作的代码,但是在地狱中,没有办法让我每次用户查看Web部件时都调用此方法(即不在构造函数中,创建子组件或(预)渲染时),而是我只希望这样做更改设置时。
I can find no information on/examples of this. 我找不到有关此示例的信息。

if you are developing your custom webpart then it may be possible to provide this functionality in the Custom tool part 如果您正在开发自定义Web部件,则可以在“自定义”工具部件中提供此功能

WHen a user changes any properties for the Web part or the custom properties of a web part then it will call the Apply changes and Sync Changes events. 当用户更改Web部件的任何属性或Web部件的自定义属性时,它将调用“应用更改”和“同步更改”事件。

So in the apply changes event you can provide your logic and check for the change in the url .. and then hide it as per your requirement, 因此,在应用更改事件中,您可以提供逻辑并检查url中的更改。然后根据需要将其隐藏,

Sorry right now i dont have any code to show. 抱歉,我现在没有任何代码可以显示。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM