Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Martijn Zuijderduijn 3 posts 23 karma points
    Jul 26, 2011 @ 16:51
    Martijn Zuijderduijn
    0

    TabView not rendering its menu properly

    Heey,

    We have a problem with a tabview not rendering its ScrollingMenu component properly. Our structure is like thus: 

    We have a MasterPage with the TabView on it:

    <cc1:TabView runat="server" ID="tabView" AutoResize="false" Width="800px" Height="400px" />

    Then we have several aspx pages with register in their OnInit Event which tabs needs to be created and which user controls in the form of a subform usercontrol needs to be added to it, example:

    protected override void OnInit(EventArgs e)

    {

     

                base.OnInit(e);

                Master.TabControl.RegisterSubFormTab(EventsPane,EventsForm, "Events");

                Master.TabControl.RegisterSubFormTab(EmployeePane, EmployeeForm, "Employees");

     }

     

     

    The function itself adds the tab to be created in a list.

    On the OnLoad() event of the MasterPage another function is called that loops through the list and adds the tabs to the tab view like so:

              private void AppendTab(AdminTab tab)

            {

                tab.Control.TabPage = UmbracoTabComponent.NewTabPage(tab.Name);

                tab.Control.TabPage.HasMenu = true;

                tab.Control.TabPage.Controls.Add(tab.Pane);

            }

    There is another piece of code that add adds buttons to the menu:

    private void CreateMenuButton(out ImageButton btn, ImageClickEventHandler handler, string toolTip, string imgUrl, bool causesValidation, string validationgroup = null)

            {

                btn = TabPage.Menu.NewImageButton();

                btn.ID = TabPage.Menu.ClientID + "_" + toolTip;

                btn.Click += new ImageClickEventHandler(handler);

                btn.ToolTip = toolTip;

                btn.AlternateText = toolTip;

                btn.ImageUrl = imgUrl;

                btn.Visible = false;

                btn.ValidationGroup = validationgroup;

                btn.CausesValidation = causesValidation;

            }

    Now when the code is run. The tabs are and the pane with its controls are shown like they are supposed to. Only one slight problem: The Menu is not rendered properly. There are no buttons visible and even the scrolling arrows on either side of the menu are not visible. The strange thing is when a postback to the server is performed the menu IS rendering properly and the buttons work just fine.

    After fiddling around for a day i cant figure out why the menu is not rendered properly the first time. It can't be that hard to build a tabpage dynamically.

     

     

     

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies