HighTechTalks DotNet Forums  

Recommended way to add child controls in CreateChildControls

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


Discuss Recommended way to add child controls in CreateChildControls in the ASP.net Building Controls forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
AT
 
Posts: n/a

Default Recommended way to add child controls in CreateChildControls - 08-03-2006 , 01:32 AM






Hi all,

What is the recommended way to add child controls *around* existing
child controls in the CreateChildControls method (e.g. table, row and
cell controls for layout purposes)?

Is the best way to keep a reference to the existing child controls,
clear the Controls collection and then re-add everything along with the
layout controls, or insert the layout controls around the existing
controls in the existing Controls collection?

Thanks,

Paul


Reply With Quote
  #2  
Old   
AT
 
Posts: n/a

Default Re: Recommended way to add child controls in CreateChildControls - 08-03-2006 , 04:22 PM






If I try to modify the Controls collection, I get a "The Controls
collection cannot be modified because the control contains code blocks"
error because my controls contain literal content (i.e. <%=
SomeValue%>). If I change the literal content to a <%# %> tag it
doesn't get picked up and is rendered empty.

Is there any way to insert layout controls around the existing controls
and preserve the literal content?

Any help would be appreciated. I'm stuck on this one.

Thanks,

Paul

paul.hester (AT) gmail (DOT) com wrote:
Quote:
Hi all,

What is the recommended way to add child controls *around* existing
child controls in the CreateChildControls method (e.g. table, row and
cell controls for layout purposes)?

Is the best way to keep a reference to the existing child controls,
clear the Controls collection and then re-add everything along with the
layout controls, or insert the layout controls around the existing
controls in the existing Controls collection?

Thanks,

Paul


Reply With Quote
  #3  
Old   
Alessandro Zifiglio
 
Posts: n/a

Default Re: Recommended way to add child controls in CreateChildControls - 08-03-2006 , 06:27 PM



Paul, in resposne to your previous post, i have already explained to you why
that is happening and how to do it properly if you want to use inline code
block expression syntax nested within your custom control.
Let me know what about it did not convince you. Also you keep posting in two
different groups simultaneously, and it will only become hard for you to
keep track.

http://groups.google.com/group/micro...=&rnum=1&hl=en

Regards,
Alessandro Zifiglio
http://www.AsyncUI.net

<paul.hester (AT) gmail (DOT) com> ha scritto nel messaggio
news:1154583151.823542.121740 (AT) p79g2000cwp (DOT) googlegroups.com...
Quote:
Hi all,

What is the recommended way to add child controls *around* existing
child controls in the CreateChildControls method (e.g. table, row and
cell controls for layout purposes)?

Is the best way to keep a reference to the existing child controls,
clear the Controls collection and then re-add everything along with the
layout controls, or insert the layout controls around the existing
controls in the existing Controls collection?

Thanks,

Paul




Reply With Quote
  #4  
Old   
AT
 
Posts: n/a

Default Re: Recommended way to add child controls in CreateChildControls - 08-03-2006 , 07:24 PM



Hi Alessandro,

Thanks for your reply, and sorry about the multiple posts - I've been
getting different responses in different groups.

I haven't tried your example yet because I couldn't see how to add the
layout elements between the child controls. I need to have table, tr
and td elements around the controls and have certain controls grouped
together in a td (e.g. all validator objects in the same td). Also,
certain custom attributes will determine the layout too. I could just
have these elements in the aspx markup file, but I'm going to be using
this control all over my site and want to avoid the code repetition.

I hope I've made this clear. Any help would be appreciated.

Thanks,

Paul

Alessandro Zifiglio wrote:
Quote:
Paul, in resposne to your previous post, i have already explained to you why
that is happening and how to do it properly if you want to use inline code
block expression syntax nested within your custom control.
Let me know what about it did not convince you. Also you keep posting in two
different groups simultaneously, and it will only become hard for you to
keep track.

http://groups.google.com/group/micro...=&rnum=1&hl=en

Regards,
Alessandro Zifiglio
http://www.AsyncUI.net

paul.hester (AT) gmail (DOT) com> ha scritto nel messaggio
news:1154583151.823542.121740 (AT) p79g2000cwp (DOT) googlegroups.com...
Hi all,

What is the recommended way to add child controls *around* existing
child controls in the CreateChildControls method (e.g. table, row and
cell controls for layout purposes)?

Is the best way to keep a reference to the existing child controls,
clear the Controls collection and then re-add everything along with the
layout controls, or insert the layout controls around the existing
controls in the existing Controls collection?

Thanks,

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.