Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6097285
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:01:33+00:00 2026-05-23T13:01:33+00:00

I’m currently building search functionality using an UpdatePanel with updatemode conditional. The trigger for

  • 0

I’m currently building search functionality using an UpdatePanel with updatemode conditional. The trigger for this updatepanel is my searchPhrase TextBox. When the TextChanged fires my panel gets updated and the right searchresults are shown.
I’m however clueless on how to implement paging functionality that will work with my searchresults.
I want paging links to be shown on a partial page update and I want the pager to also update my searchResults (only want to show 3 results on one page).
How do I set this up correctly?

This is my code (ascx)

<asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server">
</asp:ScriptManagerProxy>

<div class="searchBox">
     <asp:TextBox ID="searchPhrase" runat="server"
     AutoCompleteType="Search"
     AutoPostBack="true" />
 </div>
      <asp:UpdatePanel ID="ProductenUpdate" runat="server" UpdateMode="Conditional">    
 <ContentTemplate>                   
     <asp:Repeater ID="ProductRepeater" runat="server">
         <ItemTemplate>
             <strong><sc:Text ID="Titel" Field="Titel"
            runat="server" /></strong><br />
             <sc:Text ID="Auteur" Field="Auteur" runat="server" />
             <sc:Text ID="Intro" Field="Intro" runat="server" />
             <sc:Image ID="Thumb" Field="Thumbnail" runat="server" /><br/>
         </ItemTemplate>
     </asp:Repeater>

     <div class="filterBox">
         <asp:PlaceHolder ID="filterOnePlaceholder"
             runat="server">
             <sc:Text ID="TitelOne" Field="Filter1" runat="server" />
             <asp:CheckBoxList ID="filterOneCbl" runat="server"
                 AutoPostBack="true"
                 CssClass="checkboxList">
             </asp:CheckBoxList>
         </asp:PlaceHolder>
     </div>

     <div class="filterBox">
         <asp:PlaceHolder ID="filterTwoPlaceholder"
             runat="server">
             <sc:Text ID="TitelTwo" Field="Filter2" runat="server" />
             <asp:CheckBoxList ID="filterTwoCbl" runat="server"
                AutoPostBack="true"
 CssClass="checkboxList"
 RepeatColumns="3"
 RepeatDirection="Vertical"> 

             </asp:CheckBoxList>
         </asp:PlaceHolder>
     </div>
     <div>
         PaginaMarker DIV:
         <asp:Label ID="paginaMarker" runat="server" />
     </div>

     <script type="text/javascript">
         function ClientCallbackFunction(args)
         {

         }
     </script> 


     <asp:Button ID="btnBackwards" Text="Vorige"
OnClick="MyServerCall(this.value)" />
     <asp:Button ID="btnForward" Text="Volgende"
OnClick="MyServerCall(this.value)" />



     <asp:DropDownList ID="DropDownListChoice" runat="server"
onChange="MyServerCall(this.value)">
         <asp:ListItem>Choice 1</asp:ListItem>
         <asp:ListItem>Choice 2</asp:ListItem>
         <asp:ListItem>Choice 3</asp:ListItem>
         <asp:ListItem>Choice 4</asp:ListItem>             
     </asp:DropDownList>
 </ContentTemplate>
 <Triggers>
     <asp:AsyncPostBackTrigger ControlID="searchPhrase"
EventName="TextChanged" />
 </Triggers> </asp:UpdatePanel>

code behind:

// Needed to store the searchResults
     List<Item> validSearchResults = new List<Item>();

     private List<string> listOneSelectedItems = new List<string>();
     private List<string> listTwoSelectedItems = new List<string>();

     private string currentCategoryPath = string.Empty;

     private string _callbackArgs;


     /// <summary>
     /// Raises the <see cref="E:System.Web.UI.Control.Init"/> event.
     /// </summary>
     /// <param name="e">An <see cref="T:System.EventArgs"/> object that contains the event data.</param>
     protected override void OnInit(EventArgs e)
     {
         base.OnInit(e);

         this.UpdateSelectedItemLists();
         this.currentCategoryPath = Sitecore.Context.Item.Paths.FullPath;

         this.searchPhrase.TextChanged += new EventHandler(searchPhrase_TextChanged);

         this.filterOneCbl.SelectedIndexChanged += new EventHandler(filterOneCbl_SelectedIndexChanged);
         this.filterTwoCbl.SelectedIndexChanged += new EventHandler(filterTwoCbl_SelectedIndexChanged);
         this.ProductRepeater.ItemDataBound += new RepeaterItemEventHandler(ProductRepeater_ItemDataBound);
     }


     private void UpdateScreen()
     {
         // update the list of selectedItems for use with the selection of new Items from the index
         this.UpdateSelectedItemLists();
         this.GetSearchResults();

         ProductRepeater.DataSource = validSearchResults;
         ProductRepeater.DataBind();

         ProductenUpdate.Update();
     }

     void btnSearch_Click(object sender, EventArgs e)
     {
         // update the list of selectedItems for use with the selection of new Items from the index
         this.UpdateSelectedItemLists();
         this.GetSearchResults();

         ProductRepeater.DataSource = validSearchResults;
         ProductRepeater.DataBind();

         ProductenUpdate.Update();
     }

     private void ProductRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
     {
         Item dataItem = (Item)e.Item.DataItem;

         // if there is a dataItem
         if (dataItem != null)
         {
             if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.Item)
             {
                 Sitecore.Web.UI.WebControls.Text Titel = (Sitecore.Web.UI.WebControls.Text)e.Item.FindControl("Titel");
                 Sitecore.Web.UI.WebControls.Text Auteur =  (Sitecore.Web.UI.WebControls.Text)e.Item.FindControl("Auteur");
                 Sitecore.Web.UI.WebControls.Text Intro = (Sitecore.Web.UI.WebControls.Text)e.Item.FindControl("Intro");
                 Sitecore.Web.UI.WebControls.Image Thumb = (Sitecore.Web.UI.WebControls.Image)e.Item.FindControl("Thumb");

                 if (Thumb != null)
                 {
                     Thumb.Item = dataItem;
                 }

                 if (Titel != null)
                 {
                     Titel.Item = dataItem;
                 }

                 if (Auteur != null)
                 {
                     Auteur.Item = dataItem;
                 }

                 if (Intro != null)
                 {
                     Intro.Item = dataItem;
                 }
             }
         }            
     }

     /// <summary>
     /// Handles the TextChanged event of the searchPhrase control.
     /// </summary>
     /// <param name="sender">The source of the event.</param>
     /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
     private void searchPhrase_TextChanged(object sender, EventArgs e)
     {
         this.UpdateScreen();
     }

     /// <summary>
     /// Handles the SelectedIndexChanged event of the filterTwoCbl control.
     /// </summary>
     /// <param name="sender">The source of the event.</param>
     /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
     private void filterTwoCbl_SelectedIndexChanged(object sender, EventArgs e)
     {
         this.UpdateScreen();
     }

     /// <summary>
     /// Handles the SelectedIndexChanged event of the filterOneCbl control.
     /// </summary>
     /// <param name="sender">The source of the event.</param>
     /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
     private void filterOneCbl_SelectedIndexChanged(object sender, EventArgs e)
     {
         this.UpdateScreen();
     }

     /// <summary>
     /// Updates the selected item lists.
     /// </summary>
     private void UpdateSelectedItemLists()
     {
         foreach (ListItem thisItem in filterOneCbl.Items)
         {
             if (thisItem.Selected)
             {
                 if (!listOneSelectedItems.Contains(thisItem.Value.ToUpper()))
                 {
                     listOneSelectedItems.Add(thisItem.Value.ToUpper());
                 }
             }
         }

         foreach (ListItem thisItem in filterTwoCbl.Items)
         {
             if (thisItem.Selected)
             {
                 if (!listTwoSelectedItems.Contains(thisItem.Value.ToUpper()))
                 {
                     listTwoSelectedItems.Add(thisItem.Value.ToUpper());
                 }
             }
         }
     }

     /// <summary>
     /// Gets the search results.
     /// </summary>
     private void GetSearchResults()
     {
         SearchResultRetreiver retriever = new SearchResultRetreiver("productenSearch");
         IndexSearcher searcher = null;

         Hits mySearchResults = retriever.GetSearchResults(searchPhrase.Text.Trim(), ref searcher);

         if (mySearchResults != null)
         {
             for (int i = 0; i < mySearchResults.Length(); i++)
             {
                 Item newItem = Sitecore.Data.Indexing.Index.GetItem(mySearchResults.Doc(i),  Sitecore.Context.Database);
                 string itemTitel = SitecoreHelper.ShowItemTitel(newItem);
                 bool addItem = true;
                 if (itemTitel.StartsWith("$")) addItem = false;
                 if (itemTitel.StartsWith("_")) addItem = false;

                 if (addItem)
                 {
                     this.validSearchResults.Add(newItem);
                 }
             }
         }
     }

     private void FilterSearchResults()
     {

     }

     /// <summary>
     /// Handles the Load event of the Page control.
     /// </summary>
     /// <param name="sender">The source of the event.</param>
     /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
     protected void Page_Load(object sender, EventArgs e)
     {
         Item contextItem = Sitecore.Context.Item;
         Item subwebsiteItem = contextItem.Axes.GetAncestors().Where(c => c.Axes.Level == 4).FirstOrDefault<Item>();

         Sitecore.Data.Fields.CheckboxField filterOneSelected = subwebsiteItem.Fields["Filter1Actief"];
         Sitecore.Data.Fields.CheckboxField filterTwoSelected = subwebsiteItem.Fields["Filter2Actief"];

         if (filterOneSelected.Checked)
         {
             TitelTwo.Item = subwebsiteItem;
         }

         if (filterTwoSelected.Checked)
         {
             TitelOne.Item = subwebsiteItem;
         }

         if (!Page.IsPostBack)
         {
             string callbackRef = Page.ClientScript.GetCallbackEventReference(this, "args", "ClientCallbackFunction", "");

             string callbackScript = "function MyServerCall(args)" +
                 "{" + callbackRef + "}";

             Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "MyServerCall", callbackScript, true);

             filterOnePlaceholder.Visible = false;
             filterTwoPlaceholder.Visible = false;

             if (subwebsiteItem != null)
             {                   
                 if (filterOneSelected.Checked)
                 {
                     filterOnePlaceholder.Visible = true;  

                     Item filterOneLocation =  Sitecore.Context.Database.GetItem(subwebsiteItem.Paths.FullPath + "/Filters/Filter1");
                     List<Item> filterOneList = new List<Item>();

                     filterOneList = filterOneLocation.GetChildren().Where(c => c.TemplateName.ToLower() == "filter").ToList<Item>();

                     foreach (Item filterItem in filterOneList)
                     {
                         ListItem thisItem = new ListItem(filterItem["Naam"], filterItem.ID.ToGuid().ToString());
                         this.filterOneCbl.Items.Add(thisItem);
                     }
                 }

                 if (filterTwoSelected.Checked)
                 {
                     filterTwoPlaceholder.Visible = true;

                     Item filterTwoLocation = Sitecore.Context.Database.GetItem(subwebsiteItem.Paths.FullPath + "/Filters/Filter2");
                     List<Item> filterTwoList = new List<Item>();

                     filterTwoList = filterTwoLocation.GetChildren().Where(c => c.TemplateName.ToLower() == "filter").ToList<Item>();

                     foreach (Item filterItem in filterTwoList)
                     {
                         ListItem thisItem = new ListItem(filterItem["Naam"], filterItem.ID.ToGuid().ToString());
                         this.filterTwoCbl.Items.Add(thisItem);
                     }
                 }
             }
         }           
     }

     #region ICallbackEventHandler Members

     /// <summary>
     /// Returns the results of a callback event that targets a control.
     /// </summary>
     /// <returns>The result of the callback.</returns>
     public string GetCallbackResult()
     {
         return this._callbackArgs;
     }

     /// <summary>
     /// Processes a callback event that targets a control.
     /// </summary>
     /// <param name="eventArgument">A string that represents an event argument to pass to the event handler.</param>
     public void RaiseCallbackEvent(string eventArgument)
     {
         this._callbackArgs = eventArgument;
     }

Please have a look and tell me how I can make a pager work for my solution.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T13:01:34+00:00Added an answer on May 23, 2026 at 1:01 pm

    I’ve had this fixxed by introducing a GetList() method and an Update() method that got called after eachother. In de GetList() metthod i’d set the total amount of items and in the Update method then I’d call another method that would create the pager.
    This solved my question.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I am currently running into a problem where an element is coming back from
I want use html5's new tag to play a wav file (currently only supported
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I'm making a simple page using Google Maps API 3. My first. One marker

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.