+1-888-365-2779
Try Now
More in this section

Forums / Set-up & Installation / Search Template

Search Template

6 posts, 0 answered
  1. Evans Quirion
    Evans Quirion avatar
    2 posts
    Registered:
    24 Apr 2006
    04 Apr 2008
    Link to this post
    Sorry for my poor english I usually speak french.

    I'm trying to modify the search control template with no success. I want to use an image button instead of standard button.

    <%@ Register Assembly="Telerik.Cms.Web.UI" Namespace="Telerik.Cms.Web.UI" TagPrefix="sfWeb" %> 
    <sfWeb:CssFileLink ID="CssFileLink1" FileName="~/Sitefinity/ControlTemplates/Search/searchCommonLayout.css"   
     
    Media="screen" runat="server" /> 
    <fieldset class="sf_searchBox">  
        <table cellpadding="0" cellspacing="0" border="0"   
            style="background-image: url('/images/homepage/bloc_recherche.jpg'); background-repeat:no-repeat">  
            <tr> 
                <td style="padding-top: 22px; padding-left: 6px; width: 99px;">  
                    <asp:TextBox ID="queryText" runat="server" BorderStyle="None" BorderWidth="0px"   
                        EnableTheming="False" Font-Names="Arial"   
                        Font-Size="8pt" Width="99px"></asp:TextBox> 
                </td> 
                <td> 
    <input type="image" id="searchButton" runat="server" class="sf_searchSubmit" value="Search" alt="Search"   
     
    src="/images/homepage/bloc_recherche_d_sm.jpg"/>  
                </td> 
            </tr> 
        </table> 
    </fieldset> 

    All works fine when I change type="image" for type="button" on searchButton. How Can I use a image button ?

    Thanks
  2. Rebecca
    Rebecca avatar
    536 posts
    Registered:
    24 Sep 2012
    04 Apr 2008
    Link to this post
    Hi Evans Quirion,

    The problem with the ImageButton is caused by the fact that it doesn't implement the IAttributeAccessor interface. It is a requirement for the type of the search button. 

    You can achieve your goal by adding styles to the existing button control.

    Please look at the attachment. It contains a modified version of the template ~/Sitefinity/ControlTemplates/Search/SearchBox.ascx and an image. To make it a working example, you need to put illustration.jpg in the Images folder and replace the name of the project in the URL (ProjectName) with the real name of your project.

    Do let us know if you need any further assistance and don't worry about your English :)

    Best wishes,

    Rebecca
    the Telerik team


    Instantly find answers to your questions at the new Telerik Support Center
  3. Evans Quirion
    Evans Quirion avatar
    2 posts
    Registered:
    24 Apr 2006
    04 Apr 2008
    Link to this post
    OMG. Simply answer for a stupid question. I'm sorry to have waste your time with that. That's what happen when old vb developper recycle in web development.

    Thank you

    Evans
  4. Iwert
    Iwert avatar
    1 posts
    Registered:
    03 Dec 2007
    13 Apr 2008
    Link to this post

    It works great. but later i found that you need to change the style a bit to comply with IE7. Add: background-color:Transparent

    <input type ="button" id="searchButton" runat="server" class="sf_searchSubmit" alt="Search" style="background-image: url(http://www.myserver.com/Images/search.jpg); width: 150px; border: none; background-color:Transparent" />

  5. Devin
    Devin avatar
    149 posts
    Registered:
    09 Jun 2009
    18 Jan 2010
    Link to this post
    Hi is there a way to use an <a> tag instead of an <input> tag?

    Thanks!
    Devin
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    19 Jan 2010
    Link to this post
    Hello Devin,

    You can use HtmlAnchor and HyperLink for the search button. Note that you must specify the id of the control
    id="searchButton"

    All the best,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Register for webinar
6 posts, 0 answered