Hi, can anyone tell me what I need to put after the ? in the action statement to pass the value entered in the textbox please. I have managed to get to the results page, but I can't display the text entered. I know how to retrieve the data on the new page
but I don't know what the correct format is for the action statement.
Bramstone
None
0 Points
12 Posts
Passing a textbox value through a hyperlink
Apr 08, 2012 10:05 AM|LINK
Hi, can anyone tell me what I need to put after the ? in the action statement to pass the value entered in the textbox please. I have managed to get to the results page, but I can't display the text entered. I know how to retrieve the data on the new page but I don't know what the correct format is for the action statement.
<form method="post" action="results.cshtml?field1=&text1.text">
<input type="text" name="text1" value=""/>
<input type="submit"/>
</form>
Also to save having to write another post, I need on the new page to create a custom sql search based on the textbox entry.
I know the constructor is "SELECT * FROM tablename WHERE columnName = (need the textbox entry here please)"
The code I am using for example purposes on the results page is:
@{
String s = Request.QueryString["field1"];
}
so any help as usual always appreciated.
Only been programming with asp.net for about a week, and you guys have already taught me loads, so many thanks for everything.