protected void AdminPage_BeforeHeaderControlsAdded(object sender, EventArgs e) { // Add the admin menu to the page. Note that if you use any index other than 0 in the AddAt method, the viewstate // is not preserved across postbacks. This is the reason why the <see cref="BeforeHeaderControlsAdded"/> event was created in // <see cref="GalleryPage"/> and handled here. We need to add the admin menu *before* <see cref="GalleryPage"/> adds the album breadcrumb // menu and the gallery header. Controls.admin.adminmenu adminMenu = (Controls.admin.adminmenu)LoadControl(Util.GetUrl("/controls/admin/adminmenu.ascx")); this._adminMenu = adminMenu; this.Controls.AddAt(0, adminMenu); //this.Controls.AddAt(Controls.IndexOf(AlbumMenu) + 1, adminMenu); // Do not use: viewstate is not preserved }