Question : Problem with Templated User Control

Greetings.  I've created a templated user control by following the code on microsoft's website but it doesn't seem to work.  The weird thing is that it doesn't work but it doesn't crash either.  All I want to do is to be able to drop down a custom user control, type some text in between (or add other controls such as Gridviews, repeaters,etc), and have it display.  Could some please tell me what I'm doing wrong?

Here is the M$ page that I used as a guide to create the code:
http://msdn.microsoft.com/en-us/library/36574bf6.aspx

The code I actually created is below:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
<!--***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;">&nbsp;</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;">
			    &nbsp;
		    </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>

Answer : Problem with Templated User Control

The users need to resolve the name to an IP address be that via DNS, WINS or host file.

It is better to add this to DNS all external users will need this unless you edit the hosrt file locally for all the machines in the world.
Random Solutions  
 
programming4us programming4us