I have a web tool which was built by someone else. The application queries the database based on search parameters entered in by the end user such as "part number, part status, etc". When a user hits the search page they are presented with a simple text box to enter in part numbers as well as a button which toggles the show all parameters function using JavaScript. If a user searches using a bunch of parameters, a list of parts are presented. If a user clicks a part they'll be taken to the parts description page.
Dilemma: When a user hits the parts description page and then invokes the back button they are presented with the first initial search page instead of being brought back to the list of parts. I would like for them to be brought back to the list of parts instead of having the form reset.
See Code Examples Below (any help would be greatly appreciated):
ASPX Page:
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="AdvancedSearch.aspx.cs" Inherits="AdvancedSearch" %>
<%@ MasterType VirtualPath="~/MasterPage.master" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1" ClientEvents-OnRequestStart="RadAjaxManager1_OnRequestStart">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="MainContainer">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="MainContainer" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadAjaxLoadingPanel runat="server" ID="RadAjaxLoadingPanel1" IsSticky="true" Style="position: absolute; top: 0; left: 0; height: 100%; width: 100%;" />
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
<script language="javascript" type="text/javascript">
function RadAjaxManager1_OnRequestStart(ajaxManager, eventArgs) {
try {
var re = new RegExp("\.DataDump$", "ig");
if (eventArgs.EventTarget.match(re)) {
eventArgs.EnableAjax = false;
}
}
catch (err) {
alert("RadAjaxManager1_OnRequestStart(...) " + err);
}
}
function ToggleSearchOptions(sender, args) {
if (sender.get_text() == "Show Search Options") {
sender.set_text("Hide Search Options");
document.getElementById('<%= Search_Options_Container.ClientID %>').style.display = "";
}
else {
sender.set_text("Show Search Options");
document.getElementById('<%= Search_Options_Container.ClientID %>').style.display = "none";
}
sender.set_autoPostBack(false);
}
function ToggleEquipment(state) {
giTools.CheckUnCheckList('<%= Equipment_Fields.ClientID %>', state);
giTools.CheckUnCheckList('<%= Equipment_Type.ClientID %>', state);
giTools.CheckUnCheckList('<%= Equipment_Status.ClientID %>', state);
if (state == true) {
$('#<%= Equipment_Type_All.ClientID %>').attr('checked', 'checked');
$('#<%= Equipment_Status_All.ClientID %>').attr('checked', 'checked');
}
else {
$('#<%= Equipment_Type_All.ClientID %>').removeAttr("checked");
$('#<%= Equipment_Status_All.ClientID %>').removeAttr("checked");
}
}
function ToggleEquipment_Type(state) {
giTools.CheckUnCheckList('<%= Equipment_Type.ClientID %>', state);
}
function ToggleEquipment_Status(state) {
giTools.CheckUnCheckList('<%= Equipment_Status.ClientID %>', state);
}
function ToggleHistory(state) {
giTools.CheckUnCheckList('<%= History_Fields.ClientID %>', state);
giTools.CheckUnCheckList('<%= History_Status.ClientID %>', state);
if (state == true) {
$('#<%= History_Status_All.ClientID %>').attr('checked', 'checked');
}
else {
$('#<%= History_Status_All.ClientID %>').removeAttr("checked");
}
}
function ToggleHistory_Status(state) {
giTools.CheckUnCheckList('<%= History_Status.ClientID %>', state);
}
function ToggleOTR(state) {
giTools.CheckUnCheckList('<%= OTR_Fields.ClientID %>', state);
giTools.CheckUnCheckList('<%= OTR_Classification.ClientID %>', state);
if (state == true) {
$('#<%= OTR_Classification_All.ClientID %>').attr('checked', 'checked');
}
else {
$('#<%= OTR_Classification_All.ClientID %>').removeAttr("checked");
}
}
function ToggleOTR_Classification(state) {
giTools.CheckUnCheckList('<%= OTR_Classification.ClientID %>', state);
}
function ToggleDates(value) {
$find('<%= Date_Start.ClientID %>').set_enabled(value);
$find('<%= Date_End.ClientID %>').set_enabled(value);
}
</script>
</telerik:RadCodeBlock>
<div id="MainContainer" runat="server">
<asp:Panel ID="Panel1" runat="server" DefaultButton="Submit">
<table class="custom_table custom_border" cellpadding="0" cellspacing="0">
<tr>
<td>Terms to Search for
</td>
<td>
<telerik:RadTextBox ID="SearchValue" runat="server" />
</td>
<td>
<telerik:RadButton ID="Submit" runat="server" Text="Search" OnClick="Submit_Click" />
</td>
<td style="text-align: center;">
<telerik:RadButton ID="ShowHideSearchOptions" runat="server" Text="Show Search Options" ButtonType="LinkButton" OnClientClicking="ToggleSearchOptions"
Width="120" />
</td>
</tr>
</table>
</asp:Panel>
<div id="Search_Options_Container" runat="server" style="display: none;">
<br />
<div class="clearfix">
<div style="float: left;">
<table class="custom_table custom_border" cellpadding="0" cellspacing="0" width="210">
<tr>
<td class="custom_border_bottom" style="padding-left: 6px; padding-right: 5px;">
<table cellpadding="0" cellspacing="0" width="100%">
<tr>
<td>
<strong>Search Equipment</strong>
</td>
<td style="text-align: right;">
<strong>
<asp:CheckBox ID="Equipment_All" runat="server" Text="All" Checked="true" onclick="ToggleEquipment(this.checked)" /></strong>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="custom_border_bottom">
<asp:CheckBoxList ID="Equipment_Fields" runat="server">
<asp:ListItem Text="TMS #" Selected="True" />
<asp:ListItem Text="Assigned To" Selected="True" />
<asp:ListItem Text="Issued To" Selected="True" />
<asp:ListItem Text="Department" Selected="True" />
<asp:ListItem Text="Manufacturer" Selected="True" />
<asp:ListItem Text="Model #" Selected="True" />
<asp:ListItem Text="Serial #" Selected="True" />
<asp:ListItem Text="Description" Selected="True" />
<asp:ListItem Text="Characteristics" Selected="True" />
<asp:ListItem Text="Calibration Procedure" Selected="True" />
<asp:ListItem Text="Calibration Standard" Selected="True" />
<asp:ListItem Text="Calibration Interval" Selected="True" />
<asp:ListItem Text="Required Accuracy" Selected="True" />
</asp:CheckBoxList>
</td>
</tr>
<tr>
<td class="custom_border_bottom">
<table cellpadding="0" cellspacing="0" width="100%">
<tr>
<td>
<strong>Type</strong>
</td>
<td style="text-align: right;">
<strong>
<asp:CheckBox ID="Equipment_Type_All" runat="server" Text="All" Checked="true" onclick="ToggleEquipment_Type(this.checked)" /></strong>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="custom_border_bottom">
<asp:CheckBoxList ID="Equipment_Type" runat="server">
<asp:ListItem Text="Electronic" Value="1" Selected="True" />
<asp:ListItem Text="Mechanical" Value="2" Selected="True" />
</asp:CheckBoxList>
</td>
</tr>
<tr>
<td class="custom_border_bottom">
<table cellpadding="0" cellspacing="0" width="100%">
<tr>
<td>
<strong>Status</strong>
</td>
<td style="text-align: right;">
<strong>
<asp:CheckBox ID="Equipment_Status_All" runat="server" Text="All" Checked="true" onclick="ToggleEquipment_Status(this.checked)" /></strong>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="custom_border_bottom">
<asp:CheckBoxList ID="Equipment_Status" runat="server">
<asp:ListItem Text="Active" Value="1" Selected="True" />
<asp:ListItem Text="NCR" Value="2" Selected="True" />
<asp:ListItem Text="CBU" Value="3" Selected="True" />
<asp:ListItem Text="TOS" Value="4" Selected="True" />
<asp:ListItem Text="Missing" Value="5" Selected="True" />
<asp:ListItem Text="Stock" Value="6" Selected="True" />
<asp:ListItem Text="Extended" Value="7" Selected="True" />
</asp:CheckBoxList>
</td>
</tr>
<tr>
<td>
<asp:CheckBoxList ID="Equipment_Status_Obsolete" runat="server">
<asp:ListItem Text="Include Obsolete" Value="Include Obsolete" />
</asp:CheckBoxList>
</td>
</tr>
</table>
</div>
<div style="float: left; margin-left: 10px;">
<table class="custom_table custom_border" cellpadding="0" cellspacing="0" width="210">
<tr>
<td class="custom_border_bottom" style="padding-left: 6px; padding-right: 5px;">
<table cellpadding="0" cellspacing="0" width="100%">
<tr>
<td>
<strong>Search History</strong>
</td>
<td style="text-align: right;">
<strong>
<asp:CheckBox ID="History_All" runat="server" Text="All" Checked="True" onclick="ToggleHistory(this.checked)" /></strong>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="custom_border_bottom">
<asp:CheckBoxList ID="History_Fields" runat="server">
<asp:ListItem Text="ID Number" Selected="True" />
<asp:ListItem Text="Inspector" Selected="True" />
<asp:ListItem Text="Inspector E-mail" Selected="True" />
<asp:ListItem Text="Remarks" Selected="True" />
</asp:CheckBoxList>
</td>
</tr>
<tr>
<td class="custom_border_bottom">
<table cellpadding="0" cellspacing="0" width="100%">
<tr>
<td>
<strong>Approval</strong>
</td>
<td style="text-align: right;">
<strong>
<asp:CheckBox ID="History_Status_All" runat="server" Text="All" Checked="true" onclick="ToggleHistory_Status(this.checked)" /></strong>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<asp:CheckBoxList ID="History_Status" runat="server">
<asp:ListItem Text="None" Value="0" Selected="True" />
<asp:ListItem Text="Accepted" Value="1" Selected="True" />
<asp:ListItem Text="Rejected" Value="2" Selected="True" />
</asp:CheckBoxList>
</td>
</tr>
</table>
</div>
<div style="float: left; margin-left: 10px;">
<table class="custom_table custom_border" cellpadding="0" cellspacing="0" width="210">
<tr>
<td class="custom_border_bottom" style="padding-left: 6px; padding-right: 5px;">
<table cellpadding="0" cellspacing="0" width="100%">
<tr>
<td>
<strong>Search OTR</strong>
</td>
<td style="text-align: right;">
<strong>
<asp:CheckBox ID="OTR_All" runat="server" Text="All" Checked="True" onclick="ToggleOTR(this.checked)" /></strong>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="custom_border_bottom">
<asp:CheckBoxList ID="OTR_Fields" runat="server">
<asp:ListItem Text="ID Number" Selected="True" />
<asp:ListItem Text="Submitter" Selected="True" />
<asp:ListItem Text="Submitter E-mail" Selected="True" />
<asp:ListItem Text="Actual accuracy" Selected="True" />
</asp:CheckBoxList>
</td>
</tr>
<tr>
<td class="custom_border_bottom">
<table cellpadding="0" cellspacing="0" width="100%">
<tr>
<td>
<strong>Classification</strong>
</td>
<td style="text-align: right;">
<strong>
<asp:CheckBox ID="OTR_Classification_All" runat="server" Text="All" Checked="true" onclick="ToggleOTR_Classification(this.checked)" /></strong>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<asp:CheckBoxList ID="OTR_Classification" runat="server">
<asp:ListItem Text="Slight" Value="1" Selected="True" />
<asp:ListItem Text="Significant" Value="2" Selected="True" />
</asp:CheckBoxList>
</td>
</tr>
</table>
</div>
<div style="float: left; margin-left: 10px;">
<table class="custom_table custom_border" cellpadding="0" cellspacing="0">
<tr>
<td class="custom_border_bottom" style="padding-left: 5px;">
<strong>
<asp:CheckBox ID="Filter_By_Date" runat="server" Text="Search by Date" onclick="ToggleDates(this.checked)" /></strong>
</td>
</tr>
<tr>
<td class="custom_border_bottom">
<telerik:RadDatePicker ID="Date_Start" runat="server" Enabled="false" Width="110" />
<telerik:RadDatePicker ID="Date_End" runat="server" Enabled="false" Width="110" />
</td>
</tr>
</table>
</div>
</div>
</div>
<br />
<table cellspacing="0" cellpadding="0">
<tr>
<td>
<telerik:RadGrid ID="Results" runat="server" AllowPaging="true" PageSize="250" AllowSorting="true" OnItemDataBound="Results_ItemDataBound" OnNeedDataSource="Results_NeedDataSource">
<MasterTableView AutoGenerateColumns="false" PagerStyle-Position="TopAndBottom" CommandItemDisplay="TopAndBottom">
<CommandItemTemplate>
<div style="padding: 5px; float: right;">
<telerik:RadButton ID="DataDump" runat="server" Text="Data Dump" OnClick="DataDump_Click" Skin="Outlook" />
</div>
</CommandItemTemplate>
<Columns>
<telerik:GridTemplateColumn DataField="id_label" SortExpression="id_label_length, id_label" HeaderText="ID #" HeaderStyle-Width="150">
<ItemTemplate>
<a href='View.aspx?id=<%# Eval("id") %>'>
<%# Eval("id_label") %></a>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridBoundColumn DataField="type" HeaderText="Type" HeaderStyle-Width="120" />
<telerik:GridBoundColumn DataField="description" HeaderText="Description" HeaderStyle-Width="600" />
</Columns>
</MasterTableView>
</telerik:RadGrid>
</td>
</tr>
</table>
<div style="padding-top: 10px; padding-bottom: 10px;">
<strong>Wildcards</strong><br />
The percent sign '%' allows for the substitution of any number characters (0, 1 or more).<br />
The underscore '_' allows for the substitution of exactly 1 character. It is cumulative so you can use '__' to substitute 2 characters for example.
</div>
</div>
</asp:Content>
Link to CS: https://drive.google.com/file/d/0B-cYAOqWVWFjUnJBeC1MTFZBcjA/view?usp=sharing
It was too long to upload and I didn't know if any other way.