一个页面就是一个类,实例化这个类就可以了,例如:
页面B.aspx有方法test()
public partial class B : System.Web.UI.Page
{
public string test()
{
return "aaaa";
}
}
页面A.aspx调用Test()方法:
public partial class A : System.Web.UI.Page
{
protected void Button_Click(object sender, EventArgs e)
{
B myB = new B();
Response.Write(myB.test());
}
}
所要注意的是没有智能提示,运行完全没问题!!
[Quote=引用 2 楼 koukoujiayi 的回复:]
一个页面就是一个类,实例化这个类就可以了,例如:
页面B.aspx有方法test()
public partial class B : System.Web.UI.Page
{
public string test()
{
return "aaaa";
}
}
页面A.aspx调用Test()方法:
public partial class A : System.Web.UI.Page
{
protected void Button_Click(object sender, EventArgs e)
{
B myB = new B();
Response.Write(myB…
[/Quote]