I have two questions.... How do I create a hyperlink on a vb.net form that sends the user to the previous selection screen with all of the selection criteria he entered still there

How do I create a hyperlink in a VB.NET form that will take the user to the previous selection screen. The screen needs to have all the data in it that he entered before clicking the search button. The hyperlink is going to be named refine search. It takes the user to the previous selection screen so he can refine his search. It still has everthing he entered prevously in it.



Question 2 I will ask in a seperate question and give it 500 pts just like this one.
lvandevenderAsked:
Who is Participating?
 
w3timCommented:
Hi there lvandervender,

One way to do it is to perhaps use a linkbutton on the second page (as the "refine search" button).

In the code for that button, add in code similar to the following;
        Dim s As String
        s += "page1.aspx"                   ' This is the page you execute the search from
        s += "?action=refine"               ' This allows the search page to identify the fact that the person is returning to refine the search
        s += "&field1=" & Request("field1").ToString ' Replace the "field1" with the name of the field in the first form
        s += "&field2=" & Request("field2").ToString ' Same as above
        Response.Redirect(s)

Then, in the Page_Load of the search page (first page), add something like;
If Request("action") = "refine" Then
       field1.Text = Request("field1").ToString
       field2.Text = Request("field2").ToString
End If

Hope this helps, it's a fairly simple solution but it should work fairly well.

Tim
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
WinForms or WebForms?
0
 
lvandevenderAuthor Commented:
webform
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
lvandevenderAuthor Commented:
Yes its a webform
0
 
w3timCommented:
Hi lvandervender,

This really will depend on how you want to implement it.  Do you want to use a single page for both the search and for the results or is it going to be two seperate ASPX pages?

Thanks,
Tim
0
 
lvandevenderAuthor Commented:
The search page and the results page are different. The refine search goes back to the original search page but it has all the data that was entered before the submit search button was clicked.
0
 
armoghanCommented:
The simplest thing of all is to add a Javascript to the link something like
onclick="history.back()"


http://www.sbrady.com/hotsource/javascript/back.html

e.g. In google screen type anything and then search , then press back button it has the searched string in it
Probably Same thing you need to do
0
 
lvandevenderAuthor Commented:
i used the history.back line of code on site u gave me and i get an error message that says "history not defined" not sure what do with that my code was this

<HTML>
<HEAD>
<TITLE>My Web Page</TITLE>
</HEAD>
<BODY>

<form>
<input type="button" value="Back" onclick="history.back()">
</form>




0
 
armoghanCommented:
I have created two file on Desktop for example purpose.

1.  html1.html

<HTML>
<HEAD>
<TITLE>My Web Page</TITLE>
</HEAD>
<BODY>
<form>
<input type=text value="hello">
</form>
<a href=html2.html>Go to Html2</a>
</BODY>
</HTML>


2.  html2.html

<HTML>
<HEAD>
<TITLE>My Web Page</TITLE>
</HEAD>
<BODY>

<form>
<input type="button" value="Back" onclick="history.back()">
</form>
</body>
</html>

First i opened the html1.html changed the value of hello and then I clicked to go to next link , then clicked the back button and i am bakc on html1 with the cahnged text
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.