Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
165
WebTab acting strange when on master page.
posted

When I put a webtab on a master page, I get the page duplicated when viewing the contents of a tab. I've checked this in IE6, IE7 and FireFox2, all with the same results. Here are the steps you can take to duplicate the issue.

  1. Create a new asp web project.
  2. Add a master page and add a WebTab control to it.
  3. Paste the following code onto the master page:

    <%@ Master Language="VB" CodeFile="MasterPage.master.vb" Inherits="MasterPage" %>
    <%
    @ Register Assembly="Infragistics2.WebUI.UltraWebTab.v8.1, Version=8.1.20081.1000, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" Namespace="Infragistics.WebUI.UltraWebTab" TagPrefix="igtab" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <
    html xmlns="http://www.w3.org/1999/xhtml" >
       <head runat="server">
          <title>Untitled Page</title>
       </head>
       <body>
          <form id="form1" runat="server">
             <div>
                This is on the master page.<br />
                <igtab:UltraWebTab ID="MasterWebTab" runat="server" Width="300px" Height="300px">
                   <DefaultTabStyle BackColor="#E1EDFF" Height="20px"></DefaultTabStyle>
                   <tabs>
                      <igtab:Tab Text="Tab 1" Key="tab1" AccessKey="1">
                         <ContentPane ID="T1" runat="server" TargetUrl="Tab1.aspx">
                            <div>
                               <asp:ContentPlaceHolder ID="Tab1Content" runat="server" />
                            </div>
                         </ContentPane>
                      </igtab:Tab>
                      <igtab:Tab Text="Tab 2" Key="tab2" AccessKey="2">
                         <ContentPane ID="T2" runat="server" UserControlUrl="Tab2.aspx">
                            <div>
                               <asp:ContentPlaceHolder ID="Tab2Content" runat="server" />
                            </div>
                         </ContentPane>
                      </igtab:Tab>
                   </tabs>
                </igtab:UltraWebTab>
                <br />
                <asp:contentplaceholder id="MainContent" runat="server" />
             </div>
          </form>
       </body>
    </
    html>
  4. Copy the following code into the Default.aspx page:

    <%@ Page Language="VB" MasterPageFile="~/MasterPage.master" Title="Untitled Page" %>
    <asp:Content ID="Content1" ContentPlaceHolderID="MainContent" Runat="Server">
      
    This is on the default.aspx page.
    </asp:Content>

  5. Create two new web forms; Tab1.aspx and Tab2.aspx.

  6. Copy the following code into Tab1.asp:

    <%@ Page Language="VB" MasterPageFile="~/MasterPage.master" Title="Untitled Page" %>
    <asp:Content ID="Content1" ContentPlaceHolderID="Tab1Content" Runat="Server">
      
    <br />
      
    This is on the first tab.
      
    <br />
    </
    asp:Content>

  7. Copy the following code into Tab2.aspx:

    <%@ Page Language="VB" MasterPageFile="~/MasterPage.master" Title="Untitled Page" %>
    <asp:Content ID="Content2" ContentPlaceHolderID="Tab2Content" Runat="Server">
       <br />
      
    This is on the second tab.
      
    <br />
    </
    asp:Content>

 

When I view default.aspx in my browser, I see the text in the master page, the tab control, then the text in default.aspx page. Tab 1 of the WebTab displays the default.aspx page again(including another tab control), but without the text contained in the default.aspx page. Tab 2 only displays a blank, blue screen.

Can someone tell me where I've gone wrong here?

  • 10880
    posted

    From what I see here, you may be using master pages incorrectly.  When using master pages, the master page serves as a template.  So when your default.aspx loads, it will compile the master page then your aspx page and make one page from the combination.  The content placeholders serve as locations that you can plug content into.  Your content page, default.aspx, will be responsible for creating content in all three placeholders and not just one. 

    From your layout it seems you would rather use user controls for your Tab1.aspx and Tab2.aspx, so Tab1.ascx and Tab2.ascx. You can place contentplaceholders inside of the tabs but you will have some issues at design time since you will only be able to access the top tab. 

    Instead you can probably use each tab's ContentPane.UserControlUrl property that you can use to load the user controls.  With that in mind, I am if you really need master pages.