Sharepoint 自定义筛选器 Web 部件
我想创建一个自定义 Web 部件,该部件具有超过 1 个筛选器 Web 部件,并且可以在运行时/设计时连接到报表查看器 Web 部件(集成模式)。
我对此进行了很多搜索,但找不到一种方法来让单个 Web 部件成为多个过滤器的提供者。
举例来说 -
- 我的
Report
接受 2 个参数Department
和Region
。 - 我想将这两个参数与具有两个下拉列表的单个 Web 部件连接(一个用于
Department
,一个用于Region
), - 两个下拉列表中的值都应传递给
Department
和Region
Report
应在报表查看器 Web 部件中呈现
到目前为止尝试过的解决方案
- 创建一个添加两个自定义放置的 Web 部件down
- 从
ITransformableFilterValues
实现的自定义下拉类 - 在 Web 上有 2 个方法,每个方法都有
ConnectionProvider
属性并返回下拉控件的实例
问题:
尽管我的自定义过滤器 Web 部件上显示了 2 个连接选项,但只能添加一个。 例如,如果我将 Filter1
(自定义 Web 部件)连接到 Department
,则我无法再次将其连接到 Report Viewer
Web 部件。
我的网络部件有这样的方法:
[ConnectionProvider("Departmet", "UniqueIDForDept", AllowsMultipleConnections = true)]
public ITransformableFilterValues ReturnCity()
{
return dropDownDepartment; // It implemets ITransformableFilterValues
}
[ConnectionProvider("Region", "UniqueIDForRegion", AllowsMultipleConnections = true)]
public ITransformableFilterValues ReturnMyRegionB()
{
return dropDownRegion; //It implemets ITransformableFilterValues
}
I want to create a custom web part that has more than 1 filter web part and that can be connected to Report Viewer Web Part (Integrated Mode) at runtime/design time.
I searched a lot for this, but could not find a way to have single web part that is a provider to more than 1 filters.
Say for example -
- My
Report
accepts 2 parameterDepartment
andRegion
. - I want to connect both parameters with single web part having two drop down (one for
Department
and one forRegion
) - Values from both the drop down should be passed to
Department
andRegion
Report
should be rendered in Report Viewer Web Part
Solution Tried so far
- Create a web part that adds two custom drop down
- Custom drop down class that implements from
ITransformableFilterValues
- Have 2 methods on the web pat each having
ConnectionProvider
attribute and return instance of drop down control
Problem:
Even though 2 connection option is shown on my custom filter web part only one can be added.
For example if I connect Filter1
(custom web part) to Department
then I am unable to connect it to Report Viewer
web part again.
My web part have methods like this:
[ConnectionProvider("Departmet", "UniqueIDForDept", AllowsMultipleConnections = true)]
public ITransformableFilterValues ReturnCity()
{
return dropDownDepartment; // It implemets ITransformableFilterValues
}
[ConnectionProvider("Region", "UniqueIDForRegion", AllowsMultipleConnections = true)]
public ITransformableFilterValues ReturnMyRegionB()
{
return dropDownRegion; //It implemets ITransformableFilterValues
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我做了类似的事情。 这可能会帮助您指明正确的方向。 我使用表单库中的数据来创建详细的报告。 我使用报告服务并使用 Web 服务连接到共享点。 http://server/_vti_bin/Lists.asmx。 我使用的报告参数是项目 ID 或 GUID。 然后我配置了我的报告查看器。 在表单库上,我使用 JavaScript 覆盖上下文菜单以添加“查看报告”。 在报告页面上,我使用查询字符串过滤器从 url 中获取项目 ID。
I did something similar. This might help point you in the right direction. I used data in a form library to create a detailed report. I used reporting services and connected to sharepoint using web services. http://server/_vti_bin/Lists.asmx. The report parameter I used was the item ID or GUID. Then I configured my report viewer. On the form library I used JavaScript to override the context menu to add "View Report". On the report page I used a Query String filter to grab the item ID out of the url.
不确定您是否能够解决您的问题。
实际上我尝试使用
AllowsMultipleConnections = true
并且效果很好:Not sure if you were able to fix your problem..
Actually I tried with
AllowsMultipleConnections = true
and it worked fine: