U
Urs
Hi
the user control below renders OK when added in the designer.
Why does it NOT render when added programmatically? Do I have to instruct
the control somehow to render, or do I miss something?
This is the code when trying to add it ... (during main page Page_Load):
Dim ctl As NewsSnippet = LoadControl(GetType(NewsSnippet),
Nothing)
Me.Controls.Add(ctl)
The user control:
<%@ Control Language="VB" AutoEventWireup="false"
CodeFile="NewsSnippet.ascx.vb"
Inherits="NewsSnippet" %>
<asp:Label ID="lblTitle" runat="server" Font-Bold="True"
Font-Names="Verdana"
Font-Size="10pt"></asp:Label>
<br />
<table style="width: 220px">
<tr>
<td style="width: 75px">
<asp:Image ID="img" runat="server" /></td>
<td style="vertical-align: top">
<asp:Label ID="lblLegend" runat="server" Font-Names="Verdana"
Font-Size="8pt"></asp:Label></td>
</tr>
</table>
<table style="width: 220px">
<tr>
<td style="width: 210px; vertical-align: top;">
<asp:Label ID="lblBody" runat="server" Font-Names="Verdana"
Font-Size="8pt"></asp:Label></td>
</tr>
</table>
Code behind, it's empty as created by VS2005:
Partial Public Class NewsSnippet
Inherits System.Web.UI.UserControl
End Class
Thanks for any hints.
Urs
the user control below renders OK when added in the designer.
Why does it NOT render when added programmatically? Do I have to instruct
the control somehow to render, or do I miss something?
This is the code when trying to add it ... (during main page Page_Load):
Dim ctl As NewsSnippet = LoadControl(GetType(NewsSnippet),
Nothing)
Me.Controls.Add(ctl)
The user control:
<%@ Control Language="VB" AutoEventWireup="false"
CodeFile="NewsSnippet.ascx.vb"
Inherits="NewsSnippet" %>
<asp:Label ID="lblTitle" runat="server" Font-Bold="True"
Font-Names="Verdana"
Font-Size="10pt"></asp:Label>
<br />
<table style="width: 220px">
<tr>
<td style="width: 75px">
<asp:Image ID="img" runat="server" /></td>
<td style="vertical-align: top">
<asp:Label ID="lblLegend" runat="server" Font-Names="Verdana"
Font-Size="8pt"></asp:Label></td>
</tr>
</table>
<table style="width: 220px">
<tr>
<td style="width: 210px; vertical-align: top;">
<asp:Label ID="lblBody" runat="server" Font-Names="Verdana"
Font-Size="8pt"></asp:Label></td>
</tr>
</table>
Code behind, it's empty as created by VS2005:
Partial Public Class NewsSnippet
Inherits System.Web.UI.UserControl
End Class
Thanks for any hints.
Urs