我使用 Sharepoint,并尝试使用多个参数连接 Web 部件。
我的问题是如何将多个参数从自定义 Web 部件传递到另一个参数。
我可以通过在自定义 webpart 中实现 ITransformableFilterValues 接口来传递一个参数,我想要做的是传递多个参数(例如 MyIndex2)。
// 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 部件类中实现它)
class FilterValues : ITransformableFilterValues
{
...
}
在您的主要网络部件中有
FilterValues _fitler1;
FitlerValues _filter2;
(显然你也需要设置它们)
添加方法以返回不同的过滤器,例如
[ConnectionProvider("Filter 1", "UniqueIDForFilter1",
AllowsMultipleConnections = true)]
public ITransformableFilterValues SetConnection()
{
return _fitler1;
}
[ConnectionProvider("Filter 2", "UniqueIDForFilter2",
AllowsMultipleConnections = true)]
public ITransformableFilterValues SetConnection2()
{
return _fitler2;
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)