且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在两个页面之间传递查询字符串

更新时间:2023-02-22 11:54:52

在第一页中,您可以在单击按钮时将其写成
In first page, you can write this on button click
Response.Redirect("yourpage.aspx?qs=" + Server.UrlEncode(textbox1.text));



在另一页上,您可以获取页面加载时的值,



On the other page, you can get the value on page load,

string QueryStringValue = Server.UrlDecode(Request.QueryString["qs"].ToString());


Response.Redirect(" Page2.apsx =?ValueToPass ="+ textBox1.tex1.trim());

在page2中加载

字符串val = request.querystring ["ValueToPass"].tostring();
Response.Redirect("Page2.apsx=?ValueToPass="+textBox1.tex1.trim());

in page2 load

string val=request.querystring["ValueToPass"].tostring();