problems with form validation controls

problems with form validation controls

am 30.01.2008 02:15:20 von merrittr

I have the following validator control:


ControlToValidate="Purchase_Date"
ErrorMessage="Invalid Date" MaximumValue="1/01/2222"
MinimumValue="1/01/1970">



I am trying to use it to validate a textbox in a form view however I
get the message:


Unable to find control id 'Purchase_Date' referenced by the
'ControlToValidate' property of 'RangeValidator1'
but as far as i can see I have the ID of the textbox?????

DataSourceID="SqlDataSource1" DefaultMode="Insert" >




..

Re: problems with form validation controls

am 30.01.2008 06:12:38 von Nathan Sokalski

I haven't seen your entire code, but based on what you have included in your
posting it looks to me like the reason is because of the fact that the
TextBox is inside a FormView and the RangeValidator is not. Try doing one of
the following (I do normally use FormView, but I think one of these might
work):

1. Place the RangeValidator inside the FormView.

OR

2. Assign the ControlToValidate property programmatically in the Load event.
You will need to use the FindControl() method and convert it to a TextBox in
order to do this.

Hopefully one of these works. Good Luck!
--
Nathan Sokalski
njsokalski@hotmail.com
http://www.nathansokalski.com/

"merrittr" wrote in message
news:1aaaf9c0-851e-4200-9d70-fcbe6966ae08@i12g2000prf.google groups.com...
>I have the following validator control:
>
>
> > ControlToValidate="Purchase_Date"
> ErrorMessage="Invalid Date" MaximumValue="1/01/2222"
> MinimumValue="1/01/1970">

>
>
> I am trying to use it to validate a textbox in a form view however I
> get the message:
>
>
> Unable to find control id 'Purchase_Date' referenced by the
> 'ControlToValidate' property of 'RangeValidator1'
> but as far as i can see I have the ID of the textbox?????
>
> > DataSourceID="SqlDataSource1" DefaultMode="Insert" >
>
>
>
>
> .