单击按钮时如何将一个以上的值传递给另一页. [英] how can I pass more than one values to another page when click the button.

查看:95
本文介绍了单击按钮时如何将一个以上的值传递给另一页.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我单击按钮时,如何将一个以上的值传递给另一页.
我看过非常文章,但所有人都说如何将一项传递给另一页
请帮助我.

how can I pass more than one values to another page when click the button.
I read very article but all of them say how pass one item two another page
please help me.

推荐答案

您可以在下面尝试,

1)构造一个类,例如带有属性的SessionObject.属性的数量取决于您希望在页面中传递多少个不同的值.
2)将SessionObject的对象存储到Session中,单击Button时从SessionObject上载相关值,然后从另一页上从Session中访问SessionObject.

还有其他解决方案.

有关会话的详细信息 [
You might try below,

1) Construct a Class for example, SessionObject with Properties. The no of Properties depends on how many different values your would like to pass around the pages.
2) Store a object of SessionObject into the Session, upload related value from the SessionObject when click on the Button and from the other page just access the SessionObject from the Session.

There would be other solutions as well.

More detail about Session[^].

:)


如何:在ASP.NET网页之间传递值 [ ^ ]是关于这个问题的优秀启动教程.
How to: Pass Values Between ASP.NET Web Pages[^] is an excellent startup tutorial with respect to this question.


阅读QueryString,但您可以这么长时间尝试一下:
Read up on QueryString, but you can so long try this:
Response.Redirect( "NextPageName.aspx?query1=" + txtBox1.Text + "&query2=" + txtBox2.Text + "&query3=" + txtBox3.Text + " );
//you can attach as many queries in the query string



要从查询字符串中检索值:



To retrieve the values from the query string:

String query1 = ( Request.QueryString[ "query1" ] != null ) ? Request.QueryString[ "query1" ] : String.Empty;

String query2 = ( Request.QueryString[ "query2" ] != null ) ? Request.QueryString[ "query2" ] : String.Empty;

String query3 = ( Request.QueryString[ "query3" ] != null ) ? Request.QueryString[ "query3" ] : String.Empty;



快乐编码,
莫尔斯



Happy Coding,
Morgs


这篇关于单击按钮时如何将一个以上的值传递给另一页.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆