且构网

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

asp.net文本框事件

更新时间:2021-11-24 02:49:26

首先,您的要求不清楚.如果您正在寻找某些搜索功能,则可以使用查询字符串将值传递到第二页.
First of all your requirement is not clear. If you are looking for some search functionality you can use Query String to pass the value to the second page.




您可以将EmployeeID的值从form1发布到form2,然后在form2上进行设置.
Hi,

you can post the value of EmployeeID from form1 to form2 and then set it on form2.


hi vikrant,

试试这个,

在我的情况下,我在第一页(Page1.aspx)中使用一个TextBox(TextBox1)和一个Button(Button1),在另一页(Page2.aspx)中使用一个TextBox(TextBox2)

Page1.aspx:->

< pre lang ="cs">受保护的无效Button1_Click(对象发送者,EventArgs e)
{
Response.Redirect(& quot; Page2.aspx?nm =& quot; + TextBox1.Text);
}</pre>


Page2.aspx:->

< pre lang ="cs">受保护的无效Page_Load(对象发送者,EventArgs e)
{
字符串名称= Request.QueryString [&"nm&"].ToString();
TextBox2.Text = name.ToString();

}</pre>
hi vikrant,

Try this,

In my case I use a TextBox(TextBox1) and a Button(Button1) in the First Page(Page1.aspx) and a TextBox(TextBox2) in an another page(Page2.aspx)

Page1.aspx:->

<pre lang="cs">protected void Button1_Click(object sender, EventArgs e)
{
Response.Redirect(&quot;Page2.aspx?nm=&quot; + TextBox1.Text);
}</pre>


Page2.aspx:->

<pre lang="cs">protected void Page_Load(object sender, EventArgs e)
{
string name = Request.QueryString[&quot;nm&quot;].ToString();
TextBox2.Text = name.ToString();

}</pre>