C# 从另一页访问控件。ASP.Net
嗯,情况就是这样。。。 我在Page1.aspx中有一个元素,我想将它从Page2.aspx管理区更改为用户…,有点C# 从另一页访问控件。ASP.Net,c#,html,asp.net,C#,Html,Asp.net,嗯,情况就是这样。。。 我在Page1.aspx中有一个元素,我想将它从Page2.aspx管理区更改为用户…,有点 test.InnerText = "testText"; 如何从第二页访问此控件?可能吗 像往常一样,谢谢大家…您需要获取表单的实例。请参阅下面我的两个表单项目 表格一 表格二 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using
test.InnerText = "testText";
如何从第二页访问此控件?可能吗
像往常一样,谢谢大家…您需要获取表单的实例。请参阅下面我的两个表单项目 表格一 表格二
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form2 : Form
{
Form1 form1;
public Form2(Form1 nform1)
{
InitializeComponent();
this.FormClosing += new FormClosingEventHandler(Form2_FormClosing);
form1 = nform1;
form1.Hide();
}
private void Form2_FormClosing(object sender, FormClosingEventArgs e)
{
//stops form from closing
e.Cancel = true;
this.Hide();
}
public string GetData()
{
return "The quick brown fox jumped over the lazy dog.";
}
}
}
好我可以将testText存储在数据库中,并在第2页修改它,在第1页恢复它。但是,还有更好的主意吗?
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form2 : Form
{
Form1 form1;
public Form2(Form1 nform1)
{
InitializeComponent();
this.FormClosing += new FormClosingEventHandler(Form2_FormClosing);
form1 = nform1;
form1.Hide();
}
private void Form2_FormClosing(object sender, FormClosingEventArgs e)
{
//stops form from closing
e.Cancel = true;
this.Hide();
}
public string GetData()
{
return "The quick brown fox jumped over the lazy dog.";
}
}
}