R
Rolf Welskes
Hello,
I have writen a simple aspnet control MyCtrl and want to use it as follows:
(c01 may be the tag-prefix):
<c01:MyCtrl>this is a simple text</c01:MyCtrl>.
The control-code:
[DefaultProperty("Text02")]
[ToolboxData("<{0}:MyCtrl runat=server></{0}:MyCtrl>")]
[PersistChildren(true)]
[ParseChildren(false)]
.... MyCtrl .... inhereted from Control (not from WebControl)
..................
//the property which should be used for the innertext.
[Category("Appearance")]
[DefaultValue("")]
[Localizable(true)]
[PersistenceMode(PersistenceMode.InnerDefaultProperty)]
public string Text02
{
get
{
String s = (String)ViewState["Text02"];
return ((s == null) ? String.Empty : s);
}
set
{
ViewState["Text02"] = value;
}
}
...............
the web-page:
..................
<c01:MyCtrl ID="myId" runat="server">this is a simple text</c01:MyCtrl>
...........
Now if there is nothing between the tags means I have:
<c01:MyCtrl ID="myId" runat="server"></c01:MyCtrl>
and I go from html-view to design-view, no problem.
Now I can enter in the propertyView under the property Text02: this is a
simple text.
If I go now to the html-view I see:
<c01:MyCtrl ID="myCtrl" runat="server"></c01:MyCtrl>
means the text is not there
If I now write a text so I have
<c01:MyCtrl ID="myCtrl" runat="server">this is a simple text</c01:MyCtrl>
and if I now go back to the design View I do not see the text under the
property Text02
Seems the designer cannot write/read 'this is a simple text' within the
tags.
What is going wrong.
Any help would be nice.
Thank you.
Rolf Welskes
I have writen a simple aspnet control MyCtrl and want to use it as follows:
(c01 may be the tag-prefix):
<c01:MyCtrl>this is a simple text</c01:MyCtrl>.
The control-code:
[DefaultProperty("Text02")]
[ToolboxData("<{0}:MyCtrl runat=server></{0}:MyCtrl>")]
[PersistChildren(true)]
[ParseChildren(false)]
.... MyCtrl .... inhereted from Control (not from WebControl)
..................
//the property which should be used for the innertext.
[Category("Appearance")]
[DefaultValue("")]
[Localizable(true)]
[PersistenceMode(PersistenceMode.InnerDefaultProperty)]
public string Text02
{
get
{
String s = (String)ViewState["Text02"];
return ((s == null) ? String.Empty : s);
}
set
{
ViewState["Text02"] = value;
}
}
...............
the web-page:
..................
<c01:MyCtrl ID="myId" runat="server">this is a simple text</c01:MyCtrl>
...........
Now if there is nothing between the tags means I have:
<c01:MyCtrl ID="myId" runat="server"></c01:MyCtrl>
and I go from html-view to design-view, no problem.
Now I can enter in the propertyView under the property Text02: this is a
simple text.
If I go now to the html-view I see:
<c01:MyCtrl ID="myCtrl" runat="server"></c01:MyCtrl>
means the text is not there
If I now write a text so I have
<c01:MyCtrl ID="myCtrl" runat="server">this is a simple text</c01:MyCtrl>
and if I now go back to the design View I do not see the text under the
property Text02
Seems the designer cannot write/read 'this is a simple text' within the
tags.
What is going wrong.
Any help would be nice.
Thank you.
Rolf Welskes