Hi,

I have a problem with a custom grid plugin of mine. I need to create a menu for use with the RowContextMenu event of the grid. Depending on the current user's access privileges, I need to show / hide certain menu items (I want to do this on the server side to avoid additional roundtrips). This is the code:

public class ObjectLinkContextMenu : Plugin
{
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            Menu menu = new Menu();
            if (Page.User.IsInRole("admins"))
            {
                MenuItem someItem = new MenuItem("AdminOnlyItem");
                someItem.Href = "AdminOnlyPage.aspx";
                menu.Add(someItem);
            }
            this.Controls.Add(menu);
        }
}
The problem is that the menu item (as well as the menu itself) doesn't get rendered at all (I cannot see it in the generated code that's sent to the browser). Is this the correct approach? Is it at all possible to have a plugin create controls?

Any help appreciated!