Tech Off Thread

2 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

Composite Control Within Dynamically added user control

Back to Forum: Tech Off
  • User profile image
    DavidBarrett

    Afternoon,

    The scenario I have is a little unusual (I have been doing .net wab development for around 6 years and this is the first time its come up.. Im hoping some one will have some ideas)

     

    Basically what I have is this:

    A database with a table laid out like this:

    ID int
    ControlName varchar
    QuestionNumber int

     

    Within my application there is a page which takes a paramater from the querystring (QuestioNumber) and uses this to do a lookup on this table, it then uses the retrieved controlName to dynamically load a user control.

     

    The above all works fine and I have over 50 pages in the site using this mechanism. The problem is that one user control that I have contains a composite control, within this there is :

    1. A text box

    2. A Validator

    3. A Literal

     

    Depending on several settings the validator is switched on/off and the literal can have its contents changed (Its basically just a shortcut so I dont have to add 3 controls to the page for every text box that I want to display...

     

    The problem is that the validators dont fire.
    When a button in the user control is clicked, the page reloads and the onclick event in the control fires before the CreateChildControls does in the composite control, so at the point when the page validadtion is taking place, the validators dont exist!

     

    I cant thinik of a way around this, so Im going to change these to be 3 seperate controls for now (although this is a pain as its a survey app and there are around 20 questions that I now need to change!)

     

    Any ideas would be appreciated.

     

    Thanks

     

    David

  • User profile image
    DCMonkey

    EnsureChildControls() ?

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.