song2siren
Programmer
Hello
I've got a search page on an online store application and I just wanted some advice on the best way to allow a user to return to their search results from other pages in the application.
For example, I need to add a 'return to search results' button which navigates back to home.aspx from details.aspx.
I'm fairly sure I would need to do this by storing session state, but I'm really not clear on how to go about this. I can't just use a javascript back function unfortunately.
My search is performed like this:
Sub getResults(Source as Object, e as EventArgs)
cmdSql = New SqlCommand("Pubs_Search", myConnection)
cmdSql.CommandType = CommandType.StoredProcedure
parameterSearch = New SqlParameter("@Search", SqlDbType.NVarChar, 255)
parameterSearch.Value = frmSearchText.text
cmdSql.Parameters.Add(parameterSearch)
parameterList = New SqlParameter("@SearchList", SqlDbType.NVarChar, 255)
parameterList.Value = frmSearchList.selectedvalue
cmdSql.Parameters.Add(parameterList)
myConnection.Open()
strResults = cmdSql.ExecuteReader(CommandBehavior.CloseConnection)
dlResults.DataSource = strResults
BindDataList
End Sub
Sub BindDataList
dlResults.DataBind()
' Display a message if no results are found
If dlResults.Items.Count = 0 Then
ErrorMsg.Text = "No items matched your query."
else
ErrorMsg.Text = ""
End If
End Sub
Any help/suggestions would be very much appreciated.
Thanks
I've got a search page on an online store application and I just wanted some advice on the best way to allow a user to return to their search results from other pages in the application.
For example, I need to add a 'return to search results' button which navigates back to home.aspx from details.aspx.
I'm fairly sure I would need to do this by storing session state, but I'm really not clear on how to go about this. I can't just use a javascript back function unfortunately.
My search is performed like this:
Sub getResults(Source as Object, e as EventArgs)
cmdSql = New SqlCommand("Pubs_Search", myConnection)
cmdSql.CommandType = CommandType.StoredProcedure
parameterSearch = New SqlParameter("@Search", SqlDbType.NVarChar, 255)
parameterSearch.Value = frmSearchText.text
cmdSql.Parameters.Add(parameterSearch)
parameterList = New SqlParameter("@SearchList", SqlDbType.NVarChar, 255)
parameterList.Value = frmSearchList.selectedvalue
cmdSql.Parameters.Add(parameterList)
myConnection.Open()
strResults = cmdSql.ExecuteReader(CommandBehavior.CloseConnection)
dlResults.DataSource = strResults
BindDataList
End Sub
Sub BindDataList
dlResults.DataBind()
' Display a message if no results are found
If dlResults.Items.Count = 0 Then
ErrorMsg.Text = "No items matched your query."
else
ErrorMsg.Text = ""
End If
End Sub
Any help/suggestions would be very much appreciated.
Thanks