smart search button not using update panel

Tracey Penberthy asked on May 17, 2017 10:45

Hiah I have a web control that contains a smart search dialog, some smart search filters and a smart search results all contained within an update panel.

When I click the search button the update progress gets displayed but then the page gets refreshed.

I am I missing some configuration here to get the page not to refresh?

here's my code

Many Thanks

<%@ Control Language="C#" AutoEventWireup="true" Inherits="Website_CMSWebParts_SmartSearch_SearchListingBase"  CodeFile="~/Website.com/CMSWebParts/SmartSearch/SearchListingBase.ascx.cs" %>
    <%@ Register Src="~/CMSWebParts/SmartSearch/SearchDialog.ascx" TagName="SearchDialog" TagPrefix="cms" %>
    <%@ Register Src="~/CMSWebParts/SmartSearch/SearchResults.ascx" TagName="SearchResults" TagPrefix="cms" %>
    <%@ Register Src="~/CMSWebParts/SmartSearch/SearchFilter.ascx" TagName="SearchFilter" TagPrefix="cms" %>
    <script runat="server">
      protected void Page_Load(object sender, EventArgs e)
        {
          cmsDateFilter.FilterValues = Website.com.Kentico.Library.Helpers.FilterHelpers.GetDateFilterValues(2008, "PublishedOn");
          cmsSortSearchFilter.FilterValues = Website.com.Kentico.Library.Helpers.FilterHelpers.GetSortFilterValues("PublishedOn");
          cmsSearchResults.SearchCondition = CMS.Search.SearchSyntaxHelper.GetFieldCondition("documentcategories", "Annual Report");
        }
     </script>


<asp:UpdatePanel runat="server" ID="DocumentListingUpdatePanel1" UpdateMode="Conditional">
    <ContentTemplate>
        <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="DocumentListingUpdatePanel1">
            <ProgressTemplate>
                Submitting
            </ProgressTemplate>
        </asp:UpdateProgress>

        <!-- dialog //-->
        <cms:SearchDialog 
            ID="cmsSearchDialog" 
            runat="server" 
            CssClass="searchDialog"
            SearchMode="AnyWord"
            ShowSearchMode="False"
            ResultWebpartID="cmsSearchResults"
            />
          <!-- Filters //-->   
          <div class="grid">
              <div class="column one-half">
                <cms:LocalizedLabel ID="lblDateFilter" ResourceString="Website.Filters.DateLabel" runat="server"></cms:LocalizedLabel><br />
                <cms:SearchFilter 
                  ID="cmsDateFilter" 
                  runat="server" 
                  SearchWebpartID="cmsSearchDialog"
                  FilterMode="DropdownList"
                />
              </div>
              <div class="column one-half">
                  <cms:LocalizedLabel ID="lblSortFilter" ResourceString="Website.Filters.SortLabel" runat="server"></cms:LocalizedLabel><br />
                  <cms:SearchFilter 
                      ID="cmsSortSearchFilter" 
                      runat="server"
                      SearchWebpartID="cmsSearchDialog"
                      FilterMode="DropdownList"
                      FilterIsConditional="false"
                      FilterClause="Must"
                      DefaultSelectedIndex="2" />
              </div>
          </div>
    <!-- Results //-->
    <cms:SearchResults ID="cmsSearchResults" 
        CurrentPageTemplate="Website.Transformations.PagerTransformations-General-CurrentPage"
        FirstPageTemplate="Website.Transformations.PagerTransformations-General-FirstPage"
        LastPageTemplate="Website.Transformations.PagerTransformations-General-LastPage"
        PreviousGroupTemplate="Website.Transformations.PagerTransformations-General-PreviousGroup"
        NextGroupTemplate="Website.Transformations.PagerTransformations-General-NextGroup"
        LayoutTemplate="Website.Transformations.PagerTransformations-General-PagerLayout"
        Indexes="Documents"
        TransformationName="Website.Transformations.AnnualReportListingItem"
        SearchOnEachPageLoad="true"
        runat="server" />
    </ContentTemplate>
</asp:UpdatePanel>

Correct Answer

Brenden Kehren answered on May 17, 2017 15:11

The search button is a link <a> so it's not posting back, it's actually navigating back to the same page with URL parameters added on to the URL.

0 votesVote for this answer Unmark Correct answer

Recent Answers


Tracey Penberthy answered on May 17, 2017 10:55

Note: If I set the filters to use FilterAutoPostback="true" then they use the update panel as expected and do not cause a page refresh. How do I get the search button in the search dialog to do the same?

Cheers

0 votesVote for this answer Mark as a Correct answer

Tracey Penberthy answered on May 17, 2017 15:20

Ah that makes sense thanks Brenden

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.