如何在第二页标签中显示第一页文本框值 [英] How to display First page Textbox value in 2nd page label

查看:171
本文介绍了如何在第二页标签中显示第一页文本框值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友们,



正在使用asp.net c#sqlserver2005数据库。



我想要在第二页标签中显示第一页文本框值



我有两页

1)注册页

2)查看详情



在第一页我有文本框并提交按钮

提交按钮将重定向到第2页



我想在Page2标签中显示Textbox值



请帮忙。



谢谢。

解决方案

1。按钮点击写下这段代码

protected void ImageButton1_Click1(object sender,ImageClickEventArgs e)

{

Response.Redirect(page.aspx? id =+ textbox.text);

}





2.在2ed页面上获取此值使用



protected void Page_Load(object sender,EventArgs e)

{

label.text = Request。 QueryString [id];



}


如果要在另一页上显示一个文本框的值,那么 QueryString 将是一个不错的选择。但是,如果需要显示多个文本框(控件)的值,则可以使用按钮的 PostBackUrl 属性。有了这个,您将能够使用 PreviousPage 属性访问下一页的第一页的所有控件。



请参阅以下链接,了解更多关于按钮的 PostBackUrl 属性。



http:/ /msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.button.postbackurl(v=vs.110).aspx [ ^ ]

Hi friends,

am working on asp.net c# sqlserver2005 database.

I want to display First page Textbox value in 2nd page label

I have two pages
1)Registration Page
2)View Details

In first page I have Textbox and submit button
submit button will redirect to page2

I want to show Textbox value in Page2 label

Please help.

Thanks.

解决方案

1. on button click write this code
protected void ImageButton1_Click1(object sender, ImageClickEventArgs e)
{
Response.Redirect("page.aspx?id=" + textbox.text);
}


2. On 2ed page get this value using

protected void Page_Load(object sender, EventArgs e)
{
label.text = Request.QueryString["id"];

}


If you want to display the value of one textbox on another page then QueryString will be a good option. But if you need to display the values of multiple textboxes (controls) then you can use the PostBackUrl property of button. With this you would be able to access all the controls of first page on next page with PreviousPage property.

Please refer the following link to know more about the PostBackUrl property of button.

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.button.postbackurl(v=vs.110).aspx[^]


这篇关于如何在第二页标签中显示第一页文本框值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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