How to allow my control contains a text inside it\'s tags?
Text
My control contains a complex t
Just add one line before the class ([ParseChildren(true, "TestInnerText")]), and add a property named "TestInnerText". Create any control of your choice, I have created LiteralControl just to display inner html view.
"TestInnerText" - is just a temporary name I gave, you can use any property name of your choice.
Do the following change in my.aspx.cs file,
[ParseChildren(true, "TestInnerText")]
public partial class My : UserControl
{
public string TestInnerText
{
set
{
LiteralControl lc = new LiteralControl();
lc.Text = value;
this.Controls.Add(lc);
}
}
protected void Page_Load(object sender, EventArgs e)
{
}
}