Usercontrol og designersupport
Hvordan kan jeg få vist denne i designview i VS?Den giver hele tiden fejl, når jeg placerer noget i den, men den compiler og kører perfekt.
ASPX:
<asp:myClass ID="myClass1" runat="server">
<asp:Label ID="Label1" Text="Kan ikke vises" />
</asp:myClass>
UC:
[ParseChildren(false), PersistChildren(true)]
public partial class myClass: System.Web.UI.UserControl
{
private string GetChildren()
{
TextWriter textWriter = new StringWriter();
HtmlTextWriter htmlWriter = new HtmlTextWriter(textWriter);
RenderChildren(htmlWriter);
return (textWriter.ToString());
}
protected override void Render(HtmlTextWriter output)
{
Table table = new Table();
// .........
TableCell tc = new TableCell();
tc.Controls.Add(new LiteralControl(this.GetChildren()));
// .........
table.RenderControl(output);
}
}