views:

47

answers:

1

I'm creating a custom control, and I want to get all the stuff within the tags and use it as a string Text field on my control:

i.e.

<custom:control ID="C" runat="server">This text should go into the text property</custom:control>

Does anyone know how to achieve this? I've tried the following attributes on my text field (copied from the Literal control) but it doesn't seem to work!

    [DefaultValue(""), Bindable(true), Localizable(true)]
A: 

On the control class:

[ParseChildren(true, "TextPropertyNameHere")]
[PersistChildren(false)]

On the control's property:

[PersistenceMode(PersistenceMode.InnerDefaultProperty)]

Or something like that.

internet man