"TS" <manofsteele1@nospam.nospam> wrote in message
news:Oh7Pwy$lHHA.492@TK2MSFTNGP04.phx.gbl...
> Some of these controls i see like i said just render themselves and any
> other controls in their controls collection. They add their validation
> controls as controls of the control and then render them separately. Using
> this scenario for DropdownList i have a problem that errors out: "does not
> allow child controls". the control is inherited from dropdownlist and so
it
> won't work like the textbox control.
>
> How can i get it to work while still keeping it as a rendered (inherited)
> control?
>
> since i get this "does not allow child controls", I've tried to add the
> validation control to the control's parent.controls and the control's
> page.controls collection to get around it but i then get "The control
> collection cannot be modified during DataBind, Init, Load, PreRender or
> Unload phases", so I am kinda stuck.
>
> If i just simply render the control instead of add it to the control
> hierarchy, it won't validate correctly though it is in the html source.
>
> thanks
>
>
> "Walter Wang [MSFT]" <wawang@online.microsoft.com> wrote in message
> news:Un8f$qJiHHA.4332@TK2MSFTNGHUB02.phx.gbl...
> > Hi TS,
> >
> > I think a TextBox with validation is a special case here since you could
> > either use a composite control or implements IValidator interface to add
> > validation function to a class
> > (
http://www.codeproject.com/aspnet/selfvalidatingtextbox.asp).
> >
> > For a composite control with a single constituent control, the
difference
> > between composition and inheritance would be:
> >
> > 1) A composite control will need to implement INamingContainer, which
will
> > create a naming container for the children.
> >
> > 2) Inherited control still has public methods/properties for your user,
> > while a composite control will have to expose the only child to let your
> > user use the properties/methods directly.
> >
> > Other than these, I believe other things such as performance will not be
> > affected.
> >
> > Regards,
> > Walter Wang (wawang@online.microsoft.com, remove 'online.')
> > Microsoft Online Community Support
> >
> > ==================================================
> > When responding to posts, please "Reply to Group" via your newsreader so
> > that others may learn and benefit from your issue.
> > ==================================================
> >
> > This posting is provided "AS IS" with no warranties, and confers no
> rights.
> >
>
>