Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > multiple custom filters for data source web part View modes: 
User avatar
Member
Member
Tom - 9/11/2011 1:08:04 PM
   
multiple custom filters for data source web part
Could you please explain details of how you would add a 2nd filter or 3rd (let's say Region) to the example at:

http://devnet.kentico.com/Knowledge-Base/Web-parts---Controls/Custom-filter-for-data-source-web-parts.aspx




User avatar
Member
Member
kentico_michal - 9/12/2011 12:02:26 AM
   
RE:multiple custom filters for data source web part
Hello,

By default, there is an option to connect only one filter to data source. You need to set up the Filter name property of the filter to match the Filter name property of the datasource.

However, if you want to chain more than one filter, you can use the SourceFilterName property of the Filter web part and set it to a Filter name of a the other Filter web part:

Filter A:
Filter Name : FilterA
SourceFilterName: FilterB

Filter B:
Filter Name : FilterB

Data source:
Filter Name: FilterB

Of course, by default, there is no property called SourceFilterName, so you will need to add it in the Site manager [Development -> Web parts -> General -> Filter -> Properties] and modify the code of the filter web part [~/CMSWebParts/General/filter.ascx.cs]:

private string mSourceFilterName = null;
public string SourceFilterName
{
get
{
return ValidationHelper.GetString(this.GetValue("SourceFilterName"), mSourceFilterName);
}
set
{
this.SetValue("SourceFilterName", value);
this.mSourceFilterName = value;
}
}

The following definition needs to be added to Load_Filter method:

this.mFilterControl.SourceFilterName = this.SourceFilterName;


For more related information, I would like to point you to the following blog: Custom filter development with Kentico CMS

Best regards,
Michal Legen