带两个或更多参数的ITransformableFilterValues接口[SharePoint WebParts] [英] ITransformableFilterValues interface with two or more parameters [SharePoint WebParts]
问题描述
我使用Sharepoint,我尝试连接多个参数的网络零件。
I working with Sharepoint, and I try to connect web-parts with multiple parameters.
我的问题是如何从一个custome网络传递多个参数
My question is how do I pass more than one parameter from a custome web part to another.
我可以通过在自定义webpart中实现ITransformableFilterValues接口传递一个参数,我想要做的是传递多个参数(MyIndex2 for示例)。
I am able to pass one parameter by implementing the ITransformableFilterValues interface in the custom webpart , what I want to do is pass more than one parameter (MyIndex2 for example).
// Configure interface
public bool AllowEmptyValue
{
get { return false; }
}
public bool AllowAllValue
{
get { return true; }
}
public bool AllowMultipleValues
{
get { return true; }
}
public string ParameterName
{
get { return "MyIndex"; } // Name of provided parameter
}
public ReadOnlyCollection<string> ParameterValues
{
get
{
EnsureChildControls();
List<string> MyFilterValues = new List<string>();
if (MyFilterValue != null)
{
MyFilterValues.Add(MyFilterValue); //Provided value for another web-part
}
ReadOnlyCollection<string> result = new ReadOnlyCollection<string>(MyFilterValues);
return result;
}
}
[ConnectionProvider("MyIndex", "UniqueIDForRegionConnection", AllowsMultipleConnections = true)]
public ITransformableFilterValues SetConnection()
{
return this;
}
感谢您的帮助。
推荐答案
创建一个实现了ITransformableFilterValues接口的类(而不是在Web部件类中实现它)
Create a class that implements the ITransformableFilterValues interface (rather than implementing it in your web part class)
class FilterValues : ITransformableFilterValues
{
...
}
在您的主要网络部分有
FilterValues _fitler1;
FitlerValues _filter2;
(显然您还需要设置它们)
(obviously you will need to set them up too)
添加方法以返回不同的过滤器,例如
Add methods to return the different filters e.g.
[ConnectionProvider("Filter 1", "UniqueIDForFilter1",
AllowsMultipleConnections = true)]
public ITransformableFilterValues SetConnection()
{
return _fitler1;
}
[ConnectionProvider("Filter 2", "UniqueIDForFilter2",
AllowsMultipleConnections = true)]
public ITransformableFilterValues SetConnection2()
{
return _fitler2;
}
这篇关于带两个或更多参数的ITransformableFilterValues接口[SharePoint WebParts]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!