The prefabbed SimpleSearch control isn't working as is. No matter what I enter as my keyword search phrase, I receive the error message, "Search keyword must be at least 1 characters in length excluding spaces and wildcards." I'm not redirected to a results page under any circumstance. I'm on a fresh install of AC Gold (not upgraded from 7).
I discovered the problem while working on a customization of the control (intended to search products, specifically). I'm pretty certain I've traced the issue to the way the control is supposed to handle errors. Search starts working when I comment out the ASP Button control SearchButton, from validation group to close, as such (see lines 7-8):
Code: Select all
<div class="simpleSearchPanel">
<asp:Panel ID="SearchPanel" runat="server" CssClass="innerSection">
<asp:ValidationSummary ID="SearchValidation" runat="server" ShowMessageBox="true" validationgroup="Search" Visible="true"/>
<asp:TextBox ID="SearchPhrase" runat="server" CssClass="searchPhrase"
Text="Search Products by Model # or Keyword" MaxLength="60"></asp:TextBox>
<asp:Button ID="SearchButton" runat="server" Text="Search"
OnClick="SearchButton_Click" CausesValidation="true" /><!--validationgroup="Search"
onclientclick="if(Page_ClientValidate('Search')){{window.location='{0}?k='+encodeURIComponent({1}.value);}}return false;" />-->
<cb:SearchKeywordValidator ID="SearchPhraseValidator" runat="server" ControlToValidate="SearchPhrase"
ErrorMessage="Search keyword must be at least {0} characters in length excluding spaces and wildcards."
Text="*" ValidationGroup="Search" Display="None" KeywordRequired="true"></cb:SearchKeywordValidator>
</asp:Panel>
</div>
Code: Select all
Server Error in '/store' Application.
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
Source Error:
Line 161: {
Line 162: Trace.Write(this.GetType().ToString(), "Begin BindProductList");
Line 163: ProductList.DataSource = ProductDataSource.AdvancedSearch(_patternKeywords, _categoryId, _manufacturerId, true, true, true, 0, 0, _pageSize, (_hiddenPageIndex * _pageSize), SortResults.SelectedValue);
Line 164: ProductList.DataBind();
Line 165: NoSearchResults.Visible = (_searchResultCount == 0);