Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

asp:HyperLink from one page to execute form submission on another page 1

Status
Not open for further replies.

URLJones

Programmer
Jun 14, 2004
42
CA
Hi,

I was hoping someone could help. I have a page in which I have a form containing two drop-down menus and a "search" button. When the search button is clicked, the results show below the form. I should also mention that the form information is database-driven. So, there are a few Queries made to 1) fill the dropdowns; and 2) get and display the results.

Now, the problem is that I have a link on a second page that, when clicked, should pass along some query information to the first page (mentioned above), and have the form execute this query automatically (as if the "search" button was clicked), and finally display the results below the form.

I've seen some mention of cross-page posting, but I wasn't sure if that fit exactly to my current needs. Any help would be much appreciated!

Thanks,

URL
 
Have your first page look for querystring values. If they exist, select the correct item in each ddl and also execute the code that gets the results.
If the qs values don't exist, just keep the form the way it is now until the user clicks the search button.
 
Hi,

Thanks for the response. I thought I'd give an update on how I figured it out. It was due, in part by your suggestion jbenson001.

I had the link on page 2 send data through the URL:

E.g.
Code:
<a href="[URL unfurl="true"]http://URL?x=0&b=1&c=3">link</a>[/URL]

Then, in the first page's aspx.vb file, I included something like the following in the page_load function:

Code:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

If Page.IsPostback Then
    'Display results
Else
    'Extract variables from Query String and store locally
    
    'Update the form fields to display the information _
    'passed in through the query string
    '(In my case the query string held indexes to drop down
    'list items & they were used to populate the ddl's)

    'made a call to a function normally called by the Search
    'button in the form, for example:
    getData()
End If

End Sub

That was it :)

Thanks again for the help jbenson001!

- URL
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top