Problems with Templated Databound control

P

paululvinius

Hi!

In my templated databound control (inherited from
CompositeDataBoundControl) I have one template and one string get/set
property. When CreateChildControls(IEnumerable dataSource, bool
dataBinding) is being called, the string property is sometimes set and
sometimes not.

I have figured out that if the templated contains any form controls
(TextBox, RadioButton etc.), CreateChildControls are called prior to
the string property is set. If the template on the other hand does not
contain any form controls (like only a Label), CreateChildControls are
called after the string property is set.

I need the string property to be set when CreateChildControls are
called, while it determines what default template to implement.

Why am I experiencing this behavior?

/Paul
 
M

Michael Hamrah

How/where are you setting the String property? In the markup? It
sounds like when you declare a server control in the template, .NET
parses the control and tries to instantiate the template without
instantiating the parent control correctly. Either way, something in
the order of operations is incorrect. Is there a way to assign a
default value for the string property within the control?
 

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,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top