如何将值导航到其他页面 [英] How to navigate values to other page
本文介绍了如何将值导航到其他页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
在行下方编写的按钮"PostBackUrl"属性上传递值.任何人都可以告诉我如何传递值
Hi all,
on button "PostBackUrl" property written below line to pass value .Can any one tell me how can I pass the value
PostBackUrl="http://localhost:62784/checkout.aspx?value=txtcurrentuser"
推荐答案
您可以使用以下任何一种方式来传输值
- 查询字符串
- Cookies
- 会话变量
- Server.Transfer
- 回发URL
You may use any of below ways to transfer values
- Query Strings
- Cookies
- Session variables
- Server.Transfer
- Post Back URL
对于查询字符串中的多个值,您必须将postbackurl设置为
http://localhost:62784/checkout.aspx?value = txtcurrentuser&value2 = somevalue
即使用&
For Multiple values in Query string you have to make postbackurl like
http://localhost:62784/checkout.aspx?value=txtcurrentuser&value2=somevalue
ie separate values with &
分隔值,您可以使用Session
例如
在后面的代码中
you can use Session
for Example
in code behind
Session["username"] = this.txtUserName.Text
Session["password"] = this.txtPassword.Text
那么如果您想检索到其他页面
例如
您想将值传递给字符串x,y并进行一些条件
then if you want to retrieve to other page
for example
you want to pass the value to string x,y and make some condition
string x = Session["username"].ToString().Trim();
string y = Session["password"].ToString().Trim();
if ( x != string.Empty && y != string.Empty )
{
/*Do Something*/
}
这篇关于如何将值导航到其他页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文