Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > custom validator and ControlToValidate in a composite control...

Reply
Thread Tools

custom validator and ControlToValidate in a composite control...

 
 
Donal McWeeney
Guest
Posts: n/a
 
      09-28-2004
The ControlToValidate property is wrecking my head.

I have a custom composite server control defined as follows:

internal abstract class MyControlBase : Control, INamingContainer
{...}

[ValidationProperty("ValidationValue")]
internal class MyControl : MyControlBase
{...}

MyControl in its CreateChildControls method creates the following:
- an array of RadioButton control
- a TextBox
- a custom validator that I have written.

If I set the validator ControlToValidate property to the TextBox it works
fine however it may not be created or rendered. The only thing I can be
guarnteed of rendering is the array or RadioButtons.

If I set the validator ControlToValidate to the ID of the instance of
MyControl I get the following error:

Unable to find control id 'idMyControl' referenced by the
'ControlToValidate'
property of 'idMyControl-rfv'.

Must ControlToValidate refer to a child of the naming container or can it be
the control that implements the naming container?

Is it possible in my custom validator to tell the base validator code not to
worry about the ControlToValidate property...

Help!!! Going beserk...

Thanks

Donal



 
Reply With Quote
 
 
 
 
Donal McWeeney
Guest
Posts: n/a
 
      09-29-2004
I think I found half the answer... I can override the ControlPropertiesValid
method and in that only continue checking the ControlToValidate property if
its not blank.

Still wondering about...

Must ControlToValidate refer to a child of the naming container or can it be
the control that implements the naming container?



 
Reply With Quote
 
 
 
Reply

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Easy access to the control specified in a validator's ControlToValidate property Nathan Sokalski ASP .Net 0 03-08-2010 08:23 PM
Accessing the ControlToValidate control in a Validator Nathan Sokalski ASP .Net 1 05-20-2008 10:49 PM
Accessing the ControlToValidate control in a Validator Nathan Sokalski ASP .Net Web Controls 1 05-20-2008 10:49 PM
Accessing the ControlToValidate control in a Validator Nathan Sokalski ASP .Net Building Controls 1 05-20-2008 10:49 PM
Possible to create a composite control that has a child control that is a validator that validates the composite control itself? Jonathan Eric Miller ASP .Net Building Controls 2 07-22-2004 10:58 PM



Advertisments