HighTechTalks DotNet Forums  

custom validator and ControlToValidate in a composite control...

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


Discuss custom validator and ControlToValidate in a composite control... in the ASP.net Building Controls forum.



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

Default custom validator and ControlToValidate in a composite control... - 09-28-2004 , 11:14 AM






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
  #2  
Old   
Donal McWeeney
 
Posts: n/a

Default Re: custom validator and ControlToValidate in a composite control... - 09-29-2004 , 03:45 AM






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 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 - 2013, Jelsoft Enterprises Ltd.