using System; public delegate void MyDelegate(); // delegate declarationpublic interface I { event MyDelegate MyEvent; void FireAway(); }public class MyClass: I { public event MyDelegate MyEvent; public void FireAway() { if (MyEvent != null) MyEvent(); } }public class MainClass { static private void f() { Console.WriteLine("This is called when the event fires."); } static public void Main () { I i = new MyClass(); i.MyEvent += new MyDelegate(f); i.FireAway(); } }这是msdn的一个小例子,利用委托可以解决你的问题
或者frames["b"]._DoPostBack()具体参数自己可以运行后看看B的源代码
//WebRequest 在System.Net命名空间里
WebRequest request = WebRequest.Create(url);//此url为你b页面的url地址这样相当于重新加载b页面;但没有显示b页面不知道这样可不可以
public delegate void MyDelegate(); // delegate declarationpublic interface I
{
event MyDelegate MyEvent;
void FireAway();
}public class MyClass: I
{
public event MyDelegate MyEvent; public void FireAway()
{
if (MyEvent != null)
MyEvent();
}
}public class MainClass
{
static private void f()
{
Console.WriteLine("This is called when the event fires.");
} static public void Main ()
{
I i = new MyClass(); i.MyEvent += new MyDelegate(f);
i.FireAway();
}
}这是msdn的一个小例子,利用委托可以解决你的问题