I have an asp page with an input/text field and an anchor/href that links to an aspx page. What I want is to populate the label control on my aspx page with the value entered in the input/text field. How would I do that?
views:
44answers:
1There's no immediate way, with a hyperlink, to pick up values from form fields and pass them to the target of the hyperlink. You need to either:
Attach a javascript event handler to the hyperlink, rather than setting the
href=""
that targets your aspx page and passes the value from the input field in the query string. You can then use Request.QueryString["NameOfValuePassedIn"] in your aspx page to pick up the value and assign it to your label.or
Change the
<form>
element in your asp page so that itsaction
attribute points at the aspx page and then either add a submit button, or change your hyperlink so it again uses javascript, but this time to trigger the form to submit. You can then use Request.Form["NameOfValuePassedIn"] in your aspx page to pick up the value and assign it to your label.