Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Bruno 30 posts 50 karma points
    May 26, 2010 @ 12:50
    Bruno
    0

    Search in Header

    Hii,

     

    I install the XSLTsearch package for umbraco, everything allright..

    But, i need to implement in my header ( masterpage) the search, but i don't wanna show the results on the same page..

    I have one form and two buttons, one of them, it's login, and the other it's the search.. just search must jump to other page..

    Any idea?

     

    Cheers

    B.

     

     

  • Bert 128 posts 251 karma points
    May 26, 2010 @ 13:07
    Bert
    0

    Put the searchbox and the searchbutton in their own form. Post that form to the page with the search results  (XsltSeach page).

    Example:

    <form id="theID" action="{umbraco.library:NiceUrl(SearchPage/@id)}" method="post">
    ... form stuff
    </form>

  • Bruno 30 posts 50 karma points
    May 26, 2010 @ 13:39
    Bruno
    0

    I try that before, and in my template i put <form runat="server" action="/search.aspx" method="post"> ...

     

    and in a source code appears <form method="post" action="/home.aspx?" onsubmit="javascript:return WebForm_OnSubmit();" id="aspnetForm">

  • Bert 128 posts 251 karma points
    May 26, 2010 @ 13:58
    Bert
    0

    this form doesn't need to be runat="server"

    just remove the search elements out of your main 'runat' form and put them into the regular html form.

    Note that 2 forms can't nest so put them in completly seperate forms.

     

    Something like this:

    <form id="searchForm" action="{umbraco.library:NiceUrl(theidofyourresultpage)}" method="post">
    <input id="searchfor" name="search" type="text"></input>
    <input type="button" name="searchbutton"></input>
    </form>
  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    May 26, 2010 @ 15:48
    Matt Brailsford
    1

    Berts method is probably the better way to do it, but if you are using other .NET controls, and thefore have a form around everything already, try adding a script block at the top of your master page such as:

     <script runat="server">
       
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            Response.Redirect(string.Format("/search.aspx?search={0}",
                HttpUtility.UrlEncode(txtSearch.Text)));
        }
       
    </script>

    And then create your search box something like:

    <asp:Panel ID="pnlSearch" runat="server" DefaultButton="btnSearch">
        <asp:TextBox ID="txtSearch" runat="server" />
        <asp:Button id="btnSearch" runat="server" Text="Search" OnClick="btnSearch_Click" />
    </asp:Panel>

    Matt

  • Bruno 30 posts 50 karma points
    May 26, 2010 @ 19:55
    Bruno
    0

    Thanks Matt and Bert, I used the Bert´s method however the Matt´s solution must be work operating.

    Cheers.

    B.

Please Sign in or register to post replies

Write your reply to:

Draft