Hello, I am trying to create a custom control for creating tabs. The idea is that our designer can just use the control tags to generate the tabs. The problem that I am running into is that I want to be able to have a custom control that allows any number of child custom controls. So there would be a TabContainer Control, and within that there would be any number of tabs. The idea is similar to how an aspropDown list can have any number of ListItems within them. Here is my code, any help is appreciated.
1 <!-- TAB CONTAINER -->
2 <%@ Control Language="VB" AutoEventWireup="false" CodeFile="TabContainer.ascx.vb" Inherits="CustomControls_TabContainer" %>
3 <div>
4
5 <ul class="tabs">
6 <asplaceHolder ID="ph_list_items">
7
8 </asplaceHolder>
9 </ul>
10
11 </div>
12
13 <!-- INDIVIDUAL TABS -->
14 <%@ Control Language="VB" AutoEventWireup="false" CodeFile="Tab.ascx.vb" Inherits="CustomControls_Tab" %>
15 <li>
16 <asp:HyperLink ID="hp_link" runat="server" />
17 </li>
18
19 <!-- PAGE SOURCE -->
20 <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
21 <%@ Register
22 TagPrefix="uc"
23 TagName="TabContainer"
24 src="~\CustomControls\TabContainer.ascx" %>
25 <%@ Register
26 TagPrefix="uc"
27 TagName="Tab"
28 src="~\CustomControls\Tab.ascx" %>
29
30 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "31
32 <html xmlns="33 <head runat="server">
34 </head>
35 <body>
36 <form id="form1" runat="server">
37 <div>
38
39 <uc:TabContainer ID="tabs1" runat="server" IncludeArrows="True">
40 <uc:Tab ID="tab1" runat="server" LinkText="Tab1" LinkURL=" />
41 <uc:Tab ID="tab2" runat="server" LinkText="Tab1" LinkURL=" />
42 <uc:Tab ID="tab3" runat="server" LinkText="Tab1" LinkURL=" />
43 </uc:TabContainer>
44 </div>
45 </form>
46 </body>
47 </html>
For simplicity's sake I have left out the codebehind.
1 <!-- TAB CONTAINER -->
2 <%@ Control Language="VB" AutoEventWireup="false" CodeFile="TabContainer.ascx.vb" Inherits="CustomControls_TabContainer" %>
3 <div>
4
5 <ul class="tabs">
6 <asplaceHolder ID="ph_list_items">
7
8 </asplaceHolder>
9 </ul>
10
11 </div>
12
13 <!-- INDIVIDUAL TABS -->
14 <%@ Control Language="VB" AutoEventWireup="false" CodeFile="Tab.ascx.vb" Inherits="CustomControls_Tab" %>
15 <li>
16 <asp:HyperLink ID="hp_link" runat="server" />
17 </li>
18
19 <!-- PAGE SOURCE -->
20 <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
21 <%@ Register
22 TagPrefix="uc"
23 TagName="TabContainer"
24 src="~\CustomControls\TabContainer.ascx" %>
25 <%@ Register
26 TagPrefix="uc"
27 TagName="Tab"
28 src="~\CustomControls\Tab.ascx" %>
29
30 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "31
32 <html xmlns="33 <head runat="server">
34 </head>
35 <body>
36 <form id="form1" runat="server">
37 <div>
38
39 <uc:TabContainer ID="tabs1" runat="server" IncludeArrows="True">
40 <uc:Tab ID="tab1" runat="server" LinkText="Tab1" LinkURL=" />
41 <uc:Tab ID="tab2" runat="server" LinkText="Tab1" LinkURL=" />
42 <uc:Tab ID="tab3" runat="server" LinkText="Tab1" LinkURL=" />
43 </uc:TabContainer>
44 </div>
45 </form>
46 </body>
47 </html>
For simplicity's sake I have left out the codebehind.