Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 56331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T17:31:04+00:00 2026-05-10T17:31:04+00:00

Ok so the obvious answer is, because the flow of a composite control demands

  • 0

Ok so the obvious answer is, because the flow of a composite control demands my childcontrols to be created at a certain point in time. I got a problem i think other people must have had as well.

My control is a composite ‘container/collection’ control. It will be fed with an object and based on that objects data it will create a number of childcontrols. So my control will render a header (always) and x-number of, say TextBox controls (based on the object it was fed with).

I’m creating my header in CreateChildControls() obviously, but i can’t possibly create my TextBoxes there as well, because i don’t know if the object (to base the TextBoxes on) has been fed yet? I thought of exposing a property/method to set/fed the object through, but i’m not sure when it will be called.

So what do i do? I mean i can’t possibly create the TextBoxes in CreateChildControls() or can I? I mean – when is CreateChildControls() called – i know i can call EnsureChildControls() (which i already do in a property to set the innerText of the header – since i need the header to be created before setting its innerText obviously).

How about this

var c = new MyContainerControl(); c.Header = 'fun'; c.TextBoxObject = myTextBoxes; 

That would raise an error (or at best not create any TextBox’es) if i put the building of the TextBoxes in CreateChildControls().

Would it be more sane to instead just store the Header in a member variable and thus not having to call EnsureChildControls() in the exposed method/property setting the Header innerText. I just don’t like this aproach much, since it would be complicating things by adding extra logic to store temporarely and later having to figure out when to set it (probably in PreRender).

Also i guess i could make some kind of Databound control, ensuring the data be present at the time of calling .DataBind(). I really don’t like this either since last i looked at creating databound controls it got very complicated.

This really should be an easy task to solve – I know I’m missing something somewhere…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T17:31:05+00:00Added an answer on May 10, 2026 at 5:31 pm

    what you’re describing IS a databound control. And yes, it’s somewhat complicated, but it’s the proper design paradigm for this type of instance.

    That said, had you considered utilizing the repeater control rather than trying to roll out your own composite which behaves in the exact same manner? Rather than passing it a random object, pass it a collection or an iList with the number of text areas you’re wanting.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 77k
  • Answers 77k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer I usually use something like: onew.onclick = new Function('fnDisplay_Computers('' +… May 11, 2026 at 3:19 pm
  • added an answer Can you establish whether this is a problem for all… May 11, 2026 at 3:19 pm
  • added an answer So I kind of figured it out myself. If you… May 11, 2026 at 3:19 pm

Related Questions

Ok, so - this is heavily related to my previous question Transforming an object
So, I'm trying to stub a database connector in order to write tests for
We have our own glue-layer-code-thingamajig that allows us to host the .NET runtime in
Ok, goal by example : a command-line app that does this: Countdown.exe 7 prints

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.