Why is it important to emphasize the server side? It is mainly because I am not very good at writing JavaScript, so I always like to put programs in CS files in the background. In fact, my idea is quite in line with the ASP. NET idea. The page display and background code are completely separated!
Assume that there is a page on which a textbox accepts user input. When the user clicks the submit button, the value entered by the user in the textbox is passed to the next page. The following two cases are described respectively:
(Assume that the target page is main. aspx and the value to be passed is stored in the string Str)
1. Click Submit and jump to the target page immediately from the current page. You can use the following code to achieve this:
Response. Redirect ("Main. aspx? STR = "+ textbox1.text );
2. Click Submit to open the target page in a new window and keep the current page. You can use the following code to achieve this:
Page. clientscript. registerstartupscript (page. GetType (), "", "window. Open (main. aspx? STR = "+ textbox1.text +" ') ", true );
To obtain the passed value on the target page, use the following code:
String STR = request. querystring ["str"]. tostring ();
Reminder: all the controls mentioned above refer to server-side controls. If you want to implement it using a client control, you must use the corresponding JavaScript code. For more information, see.
Note: This article is original works, reprint please indicate the source: http://www.cnblogs.com/luzx