Hi Rodney,
Try changing the format of the date to YYYY/MM/DD instead for the MinimumValue and MaximumValue. There could be an interpretation issue with the culture. The YYYY/MM/DD format is culture-neutral.
>Hi,
>
>I am trying to validate a date from a calendar control that is embedded in a datagrid. When the user clicks the edit button on the grid, they choose a date for the transaction and enter an amount. I have three different validation controls validating the amount field, but I can't seem to get a range validator working for the calendar control. I have embedded the range validator in the edit template of the column template for the calendar. I keep getting an error which says the date value cannot be converted to the date data type for maximum value parameter of the range validator control.
>
>Here is my code:
>
><asp:TemplateColumn HeaderText="Transfer Date">
> <ItemTemplate>
> < % ERROR: # Container.DataItem("TransferDateDT") % >
> </ItemTemplate>
> <EditItemTemplate>
> <asp:Calendar ID="calTransferDate" Runat="server" Font-Size="8pt" Font- Names="Verdana" SelectedDate='< % ERROR: # Container.DataItem("TransferDateDT") % >'>
> </asp:Calendar>
> <asp:RangeValidator ID="TransferDateValidator" Display="Dynamic" Runat="server" ErrorMessage="Date must be between today and 7 days in the future." ControlToValidate="calTransferDate" MinimumValue='< % ERROR: # ctype(#9/26/2002#, date) % >' MaximumValue='< % ERROR: # ctype(#10/03/2002#, date) % >' Type="Date" />
> </EditItemTemplate>
></asp:TemplateColumn>
>
>
>Has anyone else done this? If not, does anyone know of a sample that illustrates this, I cannot seem to find one.
>
>Thanks in advance,
>
>Rodney Hall
-----------------------------------------
Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.comwww.prenia.comWeblog: blogs.prenia.com/cathi