我有page2.asps吗?我如何在page2.aspx id = 1和name = xyz中从page1.aspx打印 [英] i have page2.asps? how can i print in page2.aspx id=1 and name =xyz from page1.aspx

查看:87
本文介绍了我有page2.asps吗?我如何在page2.aspx id = 1和name = xyz中从page1.aspx打印的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在page2.aspx中显示
id = 1和名称= xyz
来自page1.aspx

i want to display in page2.aspx
id=1 and name=xyz
from page1.aspx

推荐答案

您好,您可以将查询字符串中的ID和名称传递给page2.aspx,就像

在您的page1.aspx内的按钮上单击

Hi, You can pass the id and name inside query string to page2.aspx like

Inside your page1.aspx on a button click

Response.Redirect("~/page2.aspx?id="+ yourId +"&name="+ yourName;


然后在page2.aspx中获取它们


Then in page2.aspx you fetch them

int id = int.Parse(Request.QueryString("id").ToString());
     string name = Request.QueryString("name").ToString(); 



您还可以根据需要使用会话.



You can also use Session depending upon your requirement.


好,可以有多种方法在当前页面上使用其他页面值.但是您的询问方式和问题听起来像是家庭作业语句要您了解 QueryString .

有关如何传递和使用查询字符串的详细信息,请参见此处:
使用QueryString在页面之间传递变量 [另一个描述该链接的链接 [
Well, there can be various ways to use other page value on current one. But the way you ask and the question sounds, it looks like the homework statement wanted you to know about QueryString.

For details of how to pass and use query strings, look here:
Passing variables between pages using QueryString[^]
Another link describing the same[^]


这篇关于我有page2.asps吗?我如何在page2.aspx id = 1和name = xyz中从page1.aspx打印的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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