从一个Web窗体到另一个Web窗体? [英] from aone webform to another webform ?
问题描述
大家好,
我正在使用vs2010,
我必须在我的项目中使用webforms.
像webform1,webform2,
在webform1中,在标签中有一些文本和一个按钮.
单击Webform1中的按钮,然后将Webform1标签文本转换为Webform2标签时,Webform2中的标签会变为一个标签.
为此我正在使用这样的.........
在webform1按钮中单击
hi every one,
i am using vs2010,
i have to webforms in my project .
like webform1, webform2,
in webform1 have some text in lable and a button.
in Webform2 have one lable when click on button in webform1 then to transfer a webform1 label text into webform2 label.
for that i am using like this.........
in webform1 buttin click
protected void BtnOne_Click(object sender, EventArgs e)
{
Response.Redirect("WebForm2.aspx");
}
在webform2.aspx.cs
in webform2.aspx.cs
protected void Page_Load(object sender, EventArgs e)
{
TextBox1.Text = HttpContext.Current.Request.Form["form1"].ToString();
}
它不起作用
注意:不使用会话,cookie,应用程序[数据] ......仅用于HttpContext
建议将不胜感激!
预先感谢,
naresh
it''s not working
note: without using sessions,cookies,application[data]......only to use HttpContext
suggestions would be appreciated!
Thanks in advance,
naresh
推荐答案
根据评论,这是我的建议;
当您离开IIS上下文时,将信息直接传递到表单的唯一方法是使用QueryString.在这里可以找到有关它的文章
使用QueryString在页面之间传递变量 [
Hi,
Based on comment''s, here is my suggestion;
As you are leaving your IIS context, the only way to pass information directly to the form is by using a QueryString. Here can you find an article about it
Passing variables between pages using QueryString[^]
Cheers
您可以使用Page.PreviousPage来获取上一页的控制信息,
这是从在此处@MSDN [
Hi,
You can use Page.PreviousPage to get previous page control information,
Here is an example taken from Here @MSDN[^]
if (Page.PreviousPage != null)
{
TextBox SourceTextBox =
(TextBox)Page.PreviousPage.FindControl("TextBox1");
if (SourceTextBox != null)
{
Label1.Text = SourceTextBox.Text;
}
}
希望对您有帮助,
谢谢
-Amit Gajjar
Hope it helps you,
Thanks
-Amit Gajjar
这篇关于从一个Web窗体到另一个Web窗体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!