More in this section

Forums / General Discussions / Can't add SearchBox to page

Can't add SearchBox to page

2 posts, 0 answered
  1. Stephen Long
    Stephen Long avatar
    20 posts
    Registered:
    29 Sep 2009
    08 Oct 2011
    Link to this post
    I have a very simple page which I have added a SearchBox to.  Now matter what I do though, I get a designer type initialization error:

    The type initializer for 'Telerik.Sitefinity.Localization.Res' threw an exception.

    How can I resolve this so that I can place the SearchBox on my page?  The simple mark-up from the page is pasted below.

    Thanks,
    Stephen


    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="SitefinityWebApp.WebForm1" %>
    <%@ Register TagPrefix="search" Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Services.Search.Web.UI.Public" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
        <search:SearchBox ID="SearchTextBox" SearchIndexPipeId="87904a9c-f50c-4a60-ba59-fa72f209d61b" BinderBoxLabelText="" UseSearchButton="true" IndexCatalogue="All" ResultUrl="~/search-results" runat="server" />
        </div>
        </form>
    </body>
    </html>
  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    11 Oct 2011
    Link to this post
    Hello Stephen Long,

    Is the page to which you add the searchbox part of a Sitefinity website or is this page external to the web application? Please note that this control cannot be used outside of a Sitefintiy website. Also the SearchBox implements IScriptControl a script manager on the page. The bellow markup works, when the ASPX page is ran in the context of a Sitefinity 4.x website:
    <asp:ScriptManager runat="server" ID="ScriptManager1"></asp:ScriptManager>
    <search:SearchBox ID="SearchTextBox" SearchIndexPipeId="87904a9c-f50c-4a60-ba59-fa72f209d61b" BinderBoxLabelText="" UseSearchButton="true" IndexCatalogue="All" ResultUrl="~/search-results" runat="server" />



    Kind regards,
    Radoslav Georgiev
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
2 posts, 0 answered