Delegate won't update page

Posted by mat690 on Stack Overflow See other posts from Stack Overflow or by mat690
Published on 2009-07-31T16:36:41Z Indexed on 2010/04/10 10:03 UTC
Read the original article Hit count: 282

Filed under:
|
|

I am trying to change the active index of a multiview by using a delegate and it doesn't work as i expect.

this is my code

        protected void ucWaitPage_FinishedWaiting(PerformAfterWaitDelegate performAfterWait)
    {
        performAfterWait.Invoke();
        this.SetIndex();
    }

    private void SetIndex()
    {
        this.mvwTest.ActiveViewIndex = 0;
    }

The performAfterWait Delegate points to the SetIndex() method.

When the performAfterWait delegate gets invoked SetIndex() gets called but when SetIndex() returns this.mvwTest.ActiveViewIndex reverts to being equal to 1.

However when i call the SetIndex() method directly it sets this.mvwTest.ActiveViewIndex = 0 and the change persists when the method returns.

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about delegates