Search Return Invalid Post Back when clicked ASP.NET VB

32 views Asked by At

I have this following code as a Header in MasterPage.Master

<div class="col-3">
    <asp:Panel ID="p_searchAll" runat="server" DefaultButton="b_searchAll">
        <div class="input-group">
           <asp:TextBox runat="server" CssClass="form-control searchAll" ID="searchAll" placeholder="Cari deals, cashback atau merchant" AutoCompleteType="Disabled"></asp:TextBox>
          <div class="input-group-append">
              <asp:LinkButton class="input-group-text btnSearchAll" id="b_searchAll" runat="server">
                 <i class="fa fa-arrow-right"></i>
              </asp:LinkButton>
          </div>
       </div>
    </asp:Panel>
</div>

And the behind code MasterPage.Master.VB:

Public Sub b_searchAll_Click(sender As Object, e As EventArgs) Handles b_searchAll.Click
   Dim key As String = searchAll.Text.Trim
     If (key.Trim <> "") Then
         Response.Redirect("/test?search=" & key)
     End If
   End Sub

When I click b_searchAll Button in first time, I get the correct result in the search Page. But when I write in searchAll textboxt and enter in the second time I get this following error:

enter image description here

This error happen when I getting result from search page and I try to search again from search page.

Anyone can help?

Thanks in Advance

0

There are 0 answers