views:

13

answers:

0

Hi all

I'm developing custom verbs for ASP.NET web parts.

I created two verbs for maximizing/minimizing the web parts.

I want to hide the minimize verb when the maximize one is clicked and vice versa.

I use the following code:

public void OnMaximize(object sender, WebPartEventArgs e)
        {
if (isMaximize)//Maximize
            {
                e.WebPart.Verbs[0].Visible = false;
                e.WebPart.Verbs[1].Visible = true;

            }
            else if (isRestore)//Restore
            {
                e.WebPart.Verbs[0].Visible = true;
                e.WebPart.Verbs[1].Visible = false;
            }
}

an exception is thrown indicating that index is out of range.

when I debug I found that the number of verbs in the webpart is zero !!

what is wrong withn this ? is there another way to do it ?

thanks