简体   繁体   English

将 ToolPart 值传递给 Sharepoint 2007 中自定义 WebPart 的用户控件

[英]pass a ToolPart value to a user control of a custom WebPart in Sharepoint 2007

I have created a Custom WebPart that has a UserControl.我创建了一个具有 UserControl 的自定义 WebPart。 I have added a Custom ToolPart(dropdown) to it as well.我也添加了一个自定义工具部分(下拉)。 What i want to achieve is that as a selection is made in the Custom ToolPart Dropdown;the value is to be passed into the code behind of the UserControl.我想要实现的是,在自定义 ToolPart 下拉菜单中进行选择;该值将传递到 UserControl 后面的代码中。 I tried to use the Custom properties of the ToolPart to pass the dropdown Value but couldnt do so.我尝试使用 ToolPart 的自定义属性来传递下拉值,但不能这样做。 Then,i declared a public property in the UserControl Class but that worked onl然后,我在 UserControl Class 中声明了一个公共属性,但它有效

You should use Synchanges() and ApplyChanges() to pass values between ToolPart and WebPart.您应该使用Synchanges()ApplyChanges()在 ToolPart 和 WebPart 之间传递值。 Once the value is passed from ToolPart to WebPart you can access the web part property from within the UserControl by using a hidden field and assigning the value to the hidden field and retrieving it from the user control.将值从 ToolPart 传递到 WebPart 后,您可以从 UserControl 中访问 web 部件属性,方法是使用隐藏字段并将值分配给隐藏字段并从用户控件中检索它。

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

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