Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > Smart search filter resetting View modes: 
User avatar
Member
Member
kmc - 1/3/2014 7:38:20 AM
   
Smart search filter resetting
Hello,

I've been having some issues with the smart search filters. I've created a webpart containing 3 search filters and a search dialog.

Whenever I click the search button on the search dialog however, the 3 filters all reset to their default on postback and are not included in the search.

I have a feeling I'm missing something silly here but have had no luck figuring it out.


<%@ Register Src="~/CMSWebParts/SmartSearch/SearchFilter.ascx" TagPrefix="uc" TagName="searchfilter" %>
<%@ Register Src="~/CMSWebParts/SmartSearch/SearchDialog.ascx" TagPrefix="uc" TagName="searchdialog" %>

<uc:searchfilter runat="server"
ID="filtType"
FilterQueryName="CMS.Root.CategoryListNoAll"
FilterWhere="c1.CategoryGUID='46996BEF-5049-4FE6-A400-E5B1EEB79F6E'"
DefaultSelectedIndex="0;1;2"
FilterMode="Checkbox"
FilterIsConditional="true"
SearchWebpartID="searchDialog"
RepeatColumns="1"
FilterClause="Must" />

<uc:searchdialog runat="server"
ID="searchDialog"
SearchMode="AnyWord"
SearchForLabel="Keyword"
ShowSearchMode="false"
OutputConvertTablesToDivs="All"
OutputFixHTML5="true" />

<uc:searchfilter runat="server"
ID="filtCategory"
FilterQueryName="CMS.Root.CategoryList"
FilterWhere="c1.CategoryGUID='DC98D799-AC24-443F-A792-039927A01462'"
FilterMode="DropdownList"
FilterIsConditional="true"
SearchWebpartID="searchDialog"
OutputConvertTablesToDivs="All"
FilterClause="Must"
ViewStateMode="Enabled" />

<uc:searchfilter runat="server"
ID="filtDiscipline"
FilterQueryName="CMS.Root.CategoryList"
FilterWhere="c1.CategoryGUID='42F055A7-C9D9-4942-BE1B-771B6EDD7D61'"
FilterMode="DropdownList"
FilterIsConditional="true"
SearchWebpartID="searchDialog"
OutputFixHTML5="true"
OutputConvertTablesToDivs="All"
FilterClause="Must" />


Any ideas would be much appreciated,

Thanks.

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 1/3/2014 12:51:23 PM
   
RE:Smart search filter resetting
Set your properties in code behind in the OnContentLoaded() method. I believe if you set them on the front side, they don't get set until PageLoad(), I could be wrong on that as well but I've had the best results with setting in code behind.