Basically, I have created a search facility which is housed inside the navigation control on every page. My predecessor set every single page up enclosed in a form for postbacks.
I need these postbacks to continue working however I need the search when submitted to post to go to a separate page and post the data.
I tried various methods such as “postbackURL” on the ImageButton but it didn’t do anything.
Below is an example of my form code from my navigation.ascx control:
<fieldset>
<div style="height:8px;"></div>
<asp:TextBox Width="116px" CssClass="search-textbox" Text="Search" style="height: 25px; background-color: #FFF; z-index: 1; color:#888;" onfocus="inputFocus(this)" onblur="inputBlur(this)" id="txtCriteria" runat="server" />
<div style="height:10px;"></div>
<asp:DropDownList Width="150px" CssClass="searchbox" Visible="true" ID="ddlDatatype" runat="server" >
<asp:ListItem Text="All" Value="all"></asp:ListItem>
<asp:ListItem Text="Title" Value="title"></asp:ListItem>
<asp:ListItem Text="Brand" Value="brand"></asp:ListItem>
<asp:ListItem Text="Description" Value="desc"></asp:ListItem>
</asp:DropDownList>
<div style="height:10px;"></div>
<asp:DropDownList Width="150px" CssClass="searchbox" Visible="true" ID="ddlCategory" runat="server" />
<div style="height:14px;"></div>
<asp:ImageButton ID="btnSubmitSearch" runat="server" style="margin-top: -2px;" ImageUrl="/images/search-go.png" />
</fieldset>
This then needs to submit to another page. Any help would be greatly appreciated. Thanks
UPDATE: I have realised this code will now work, however it will not submit and move to the next page because if there is already a form being used on the selected page, then it gets hung up on the validation of the other forms controls. An example of the validation being used is:
`<asp:RequiredFieldValidator ID="rfv_txtEmail" runat="server" ControlToValidate="txtEmail" Display="Dynamic">`
Is there any chance to bypass this form validation if the search facility was actually being used rather than the contact form? Thanks
Figured it out, just use the
CausesValidation="false"property on the submit button.