HighTechTalks DotNet Forums  

Problems with Templated Databound control

ASP.net Building Controls microsoft.public.dotnet.framework.aspnet.buildingcontrols


Discuss Problems with Templated Databound control in the ASP.net Building Controls forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
paululvinius@hotmail.com
 
Posts: n/a

Default Problems with Templated Databound control - 11-24-2006 , 03:29 AM






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


Reply With Quote
  #2  
Old   
Michael Hamrah
 
Posts: n/a

Default Re: Problems with Templated Databound control - 12-01-2006 , 03:15 PM






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?




paululvinius (AT) hotmail (DOT) com wrote:
Quote:
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


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.