How to get child controls not be treated as properties ?

D

Dmitriy Zakharov

Hi,

I'm trying to create a control that contains other controls. But the problem
is that child controls are treated as properties, and page could not be
parsed.

Parser Error Message: Type 'DataEntryPage' does not have a property named
'asp:Button'.

Source Error:

Line 46: <my:dataentrypage id="pgMissingCoverages"
runat="server">
Line 47: <asp:Button ID="fdfs" Text="dsasda"
Runat="server" />
Line 48: </my:dataentrypage>

Is there a way to get child controls into Controls collection instead of
properties?

Thanks in advance.
Dmitriy.
 
K

Kevin Spencer

You would have to develop a Templated Control to use in that manner.
Otherwise, add the Button to its Controls programmatically.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
D

Dmitriy Zakharov

I figured it out. I should declare my user control as

<ParseChildren(False)> _
Public Class DataEntryPage
....
End Class

The parameter of ParseChildren attribute controls whether child controls
should be treated as properties, or as child controls. Thanks for pointing
out a direction.

Regards,
Dmitriy.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top