我在页面上有2个按钮,其中button1.visible = false。使用自定义事件更新网页表单
代码隐藏页:
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
Class1.ShowButtonEvent += new Class1.ShowButton(Show);
}
}
public void Show()
{
Button1.Visible = true;
}
protected void Button2_Click(object sender, EventArgs e)
{
Class1.EventIT();
}
的Class1:
public static class Class1
{
public delegate void ShowButton();
public static event ShowButton ShowButtonEvent;
public static void EventIT()
{
if (ShowButtonEvent != null)
ShowButtonEvent();
}
}
这不是工作,如何解决呢?
更新:
没有答案?
好吧,我会尽量更具体,并解释我正在尝试做什么。
我在静态类中的线程中开始耗时的工作。
我使用webmethods和javascript更新UI上的状态(jQuery进度条)。
但是,当线程完成时,我需要执行一些服务器端操作,通过javascript无法做到这一点。
因此,任务是在线程完成工作时调用服务器端方法。
请发布您看到的错误消息/行为,“这不起作用”有点含糊。 – 2010-08-26 16:40:04
没有错误,按钮1只是没有隐藏起来。 – ilann 2010-08-26 19:33:02