<!--***ASPX FILE***-->
<%@ Control Language="VB" AutoEventWireup="false" CodeFile="control_content_box.ascx.vb" Inherits="User_Controls_control_info_box" %>
<!--**********************************************************-->
<table cellpadding="0" cellspacing="0" align="center" border="0">
<tr class="title_bar">
<td><img src="images/contentbox_top_left_corner.gif" alt="" /></td>
<td><img src="images/spacer.gif" width="1" height="45" alt="" align="left" />
<div style="padding: 4px 0px 0px 10px; font-size: 14px; color: white;">
<asp:Literal ID="ltl_Title" runat="server" />
</div>
</td>
<td><img src="images/contentbox_top_right_corner.gif" alt="" /></td>
</tr>
<tr>
<td style="border-left: 2px solid #9582af;"> </td>
<td align="center">
<!--*****************************-->
<div style="min-width:350px; min-height:350px;">
<asp:PlaceHolder ID="Content_Placeholder" runat="server" />
</div>
<!--*****************************-->
</td>
<td style="border-right: 2px solid #9582af;">
</td>
</tr>
<tr>
<td><img src="images/contentbox_bottom_left_corner.gif" alt="" /></td>
<td style="background: url(images/contentbox_bottom_border.gif) repeat-x;"></td>
<td><img src="images/contentbox_bottom_right_corner.gif" alt="" /></td>
</tr>
</table>
<!--**********************************************************-->
<!--**BEGIN CODE BEHIND**-->
Imports System.ComponentModel
Partial Class User_Controls_control_info_box
Inherits System.Web.UI.UserControl
Private _ContentTemplate As ITemplate = Nothing
<TemplateContainer(GetType(ContentContainer))> <PersistenceMode(PersistenceMode.InnerProperty)> <TemplateInstance(TemplateInstance.[Single])> _
Public Property ContentTemplate() As ITemplate
Get
Return _ContentTemplate
End Get
Set(ByVal value As ITemplate)
_ContentTemplate = value
End Set
End Property
Public Class ContentContainer
Inherits Control
Implements INamingContainer
End Class
Public WriteOnly Property Title() As [String]
Set(ByVal value As [String])
Me.ltl_Title.Text = value
End Set
End Property
Protected Sub Page_Init()
' If a content template has been defined on the parent page then initialize the content template
If Not (ContentTemplate Is Nothing) Then
' Instantiate and initialize the content container class
Dim container As New ContentContainer()
ContentTemplate.InstantiateIn(container)
' Add the content template to the placeholder so that we can see the user content
Me.Content_Placeholder.Controls.Add(container)
End If
End Sub
End Class
<!--***EXAMPLE OF HOW I USE THE CODE IN THE PAGE***-->
<uc1:control_content_box ID="Control_content_box1" Title="Life is Great" runat="server">
<ContentTemplate>
The Title specified above displays but the text here does not! :(
</ContentTemplate>
</uc1:control_content_box>
|