I already have a <form runat="server"> tag for my asp.net page before the search, and I was hoping to use asp.net textboxes and image buttons to control the form action. I did some searching on the site and found nothing to show how to make a asp.net form to run the search.
Here is the header:
So there is a form inside of a form. Well this is ok in Firefox, but in IE doesn't like this and I'm getting a "Invalid postback or callback argument." error so I am trying to work around it and use an asp text box and button and have the action on the specific button. That way it validates the control and I don't have to have two forms on one page. Can someone show me an example in VB of how to post to the search.aspx page so it accepts the text box text in the search.
I came up with this:
and it seems to work, but I don't know if I'm leaving out any functionality of the program. I'm using version 4 for reference.
Thanks for the help in advance!
Here is the header:
Code:
<body> <form runat="server"> <div id="mainwrapper"> <div id="logo_p"><img src="images/body/logo_p.jpg" alt="Pencom" /></div> <!--Start Header--> <div id="header"> <a href="index.aspx"><img src="images/body/logo.jpg" alt="Home" width="222" height="50" class="floatleft" title="Pencom Home" /></a> <div id="toplinks"> <ul> <li class="nobullet"><a href="contact.aspx">Contact</a></li> <li><a href="locations.aspx">Locations</a></li> <li><a href="sitemap.aspx">Site Map</a></li> <li class="nospace"><asp:LoginStatus ID="LoginStatus1" runat="server" LogoutAction="RedirectToLoginPage" /></li> </ul> <div id="search"> <form action="zoom/search.aspx" method="get"> <asp:TextBox ID="zoom_query" runat="server" Text="Search"></asp:TextBox> <asp:ImageButton ID="ImageButton1" runat="server" OnClick="zoom" ImageUrl="images/body/search1.jpg" /> <input type="text" style="font-size:8pt;" name="zoom_query" value="Search" onfocus="this.value=''" autocomplete='off' /><input type="image" src="images/body/search1.jpg" alt="Search Pencom" title="Search Pencom" style="vertical-align:bottom; border:0px;" /> </form> </div> </div> </div> <!--End Header-->
I came up with this:
Code:
Protected Sub zoom(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton1.Click Response.Redirect("zoom/search.aspx?zoom_query=" + zoom_query.Text) End Sub
Thanks for the help in advance!
Comment