tags:

views:

37

answers:

1

I have 2 buttons on page, where button1.visible = false.

Page code behind:

 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();
    }
}

This is not working, how to fix it?

UPDATE:
No answers?
Ok, I will try to be more specific and explain what I am trying to do.

I start a time consuming job in a thread within static class.
I update the status (jquery progressbar) on UI using webmethods and javascript.

But, when thread is finished I need to preform some server side operations that it's not possible to do via javascript.

So the task is to invoke server side methods when thread finishes it's work.

A: 

You need to bind the event (Class1.ShowButtonEvent += new Class1.ShowButton(Show); ) on every postback.

bleeeah
if I bind it on every postback, Show() method will be invoked multiple times, I don't want this.
ilann