I am using C# + VS2008 + .Net 3.5 + ASP.Net + IIS 7.0 + ADO.Net + SQL Server 2008. I want to develop an ASP.Net aspx page which has the following function,
1 It could accept 3 Url parameters param1, param2 and param3, and the request looks like this,
http://example.org/foo.aspx?parame1=abc¶m2=def¶m3=ghi
2 When the page is responsed to client browser, I want to display a text input and a submit button nearby in the result html page, and value of text input is the same as param1, in this sample, abc will be displayed in text box, in the browser address bar, I want to keep the original long url http://example.org/foo.aspx?parame1=abc¶m2=def¶m3=ghi;
3 When the user change the value in text input, and click submit button, I want to send this request again to foo.aspx, and changing the param1 value to the value which user entered in text input, and at the same time, keep values of parame2 and param3 the same as last request’s response. For example, when user requests http://example.org/foo.aspx?parame1=abc¶m2=def¶m3=ghi, and the page displays, when user changes text input from abc to google, the new request will be http://example.org/foo.aspx?parame1=google¶m2=def¶m3=ghi
Any reference samples? My question is I do not know how to implement so many functions in one aspx page.
If you want the browser address bar to show the updated URL you can allow the button click to postback to the server and then you handle the TextChanged event of the textbox.
In the TextChanged event handler you build the new URL with the changed querystring arguments and use Response.Redirect to redirect the browser to the new URL.
Here is a quick an dirty example.
Given a ASPX page with a textbox and a button, somthing like this
Your code behind to handle the TextChanged event of the textbox could do the following.