Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

ASP.NET

Posted on 2010-11-27
6
Medium Priority
?
427 Views
Last Modified: 2012-05-10
Dear Friends,

I have an online matrimonial portal running for almost 2 years. Suddenly outoff nowhere it started giving the below error:

System.Web.HttpException: The value '28/11/1992' of the ValueToCompare property of 'cvDOB' cannot be converted to type 'Date'.     at System.Web.UI.WebControls.CompareValidator.ControlPropertiesValid()     at System.Web.UI.WebControls.BaseValidator.get_PropertiesValid()     at System.Web.UI.WebControls.BaseValidator.OnPreRender(EventArgs e)     at System.Web.UI.Control.PreRenderRecursiveInternal()     at System.Web.UI.Control.PreRenderRecursiveInternal()     at System.Web.UI.Control.PreRenderRecursiveInternal()     at System.Web.UI.Control.PreRenderRecursiveInternal()     at System.Web.UI.Control.PreRenderRecursiveInternal()     at System.Web.UI.Control.PreRenderRecursiveInternal()     at System.Web.UI.Control.PreRenderRecursiveInternal()     at System.Web.UI.Control.PreRenderRecursiveInternal()     at System.Web.UI.Control.PreRenderRecursiveInternal()     at System.Web.UI.Control.PreRenderRecursiveInternal()     at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)


The error is generated from the following code:


___________   .aspx  code _____________________________

                                            <td class="W350">
                                            <div id="divCal" runat="server">
                                                <asp:TextBox ID="txtDOB" runat="server" MaxLength="12" CssClass="W100 fs12" TabIndex="2"
                                                    onfocus="enterfiled('row1');" onblur="onexit('row1');"
                                                    ></asp:TextBox>
                                                <%--<asp:HyperLink ID="imgDate" runat="server" ImageUrl="~/images/pdate.gif" NavigateUrl="">HyperLink</asp:HyperLink>--%>
                                                <cc1:CalendarExtender ID="ceDOB" runat="server" TargetControlID="txtDOB" CssClass="cal_Theme1"
                                                    PopupPosition="Left" Format="dd/MM/yyyy">
                                                </cc1:CalendarExtender>
                                                <asp:RequiredFieldValidator ID="rfvDOB" runat="server" ControlToValidate="txtDOB"
                                                    Display="None" ErrorMessage="Date Of Birth Required." SetFocusOnError="true"></asp:RequiredFieldValidator>
                                                 <cc1:ValidatorCalloutExtender ID="vceDOB" runat="server" TargetControlID="rfvDOB">
                                                </cc1:ValidatorCalloutExtender>
                                               
                                               
                                                 <asp:CompareValidator ID="cvDOB" runat="server" Operator="LessThan"
                                                     Type="Date" ControlToValidate="txtDOB" Display="None"
                                                 ErrorMessage="Member should be 18 years old at time of registration."
                                                    SetFocusOnError="true"></asp:CompareValidator>
                                                <cc1:ValidatorCalloutExtender ID="ValidatorCalloutExtender1" runat="server" TargetControlID="cvDOB">
                                                </cc1:ValidatorCalloutExtender>
                                                <cc1:ValidatorCalloutExtender ID="vce1" runat="server" TargetControlID="cvDOB">
                                                </cc1:ValidatorCalloutExtender>
                                               </div>
                                            </td>
                                            <td class="W20">
                                                &nbsp;
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="W20">
                                                &nbsp;
                                            </td>
                                            <td class="W350">
                                                &nbsp;
                                            </td>
                                            <td class="W50">
                                            </td>
                                            <td class="W350 fs10">
                                                <asp:Label ID="lblDOBInstruct" runat="server" Text="You can use the calendar or directly type is the date of birth in the format <b>{Month / Date / Year}</b>.<br><br>Date of Birth will be used to calculate the age and will not be displayed to others. <br><br> Should me a major <b>(minimum 18 years)</b> at the time of registration."></asp:Label>
                                            </td>
                                            <td class="W20">
                                                &nbsp;


___________________ aspx.cs code____________________________



                    cvDOB.ValueToCompare = DateTime.Now.AddYears(-18).ToShortDateString();


___________________________________________

Please help and thanks for your help.



0
Comment
Question by:MadhuMenong
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 23

Accepted Solution

by:
Rajkumar Gs earned 2000 total points
ID: 34224362
Seems something wrong related to date format.
Anything changed in the system for date format ?
I mean, changed format from MM/dd/yyyy to dd/MM/yyyy or something similar in date format ?

Raj
0
 

Author Comment

by:MadhuMenong
ID: 34224387
Dear RajkumarGS,
Thanks for your comments.

The application runs perfectly on my local system but when i upload to the web (using a shared server from znetindia) it throws up the error.

Was working perfectly till recently. Only thing that happened was znet did so upgrade or shifted the application to a new server and after that all problems started.

0
 
LVL 23

Expert Comment

by:Rajkumar Gs
ID: 34224409
Hi Madhu,

If I am right, this error The value '28/11/1992' of the ValueToCompare property of 'cvDOB' cannot be converted to type 'Date'. says that '28/11/1992' is wrong. '11/28/1992' could be right based on the new server date format.

I think, the date format in your local system and the new server is different. Can you verify this ?

Raj
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:MadhuMenong
ID: 34224452

Hi Rajkumargs,

I will try that .... give me a moment please.
0
 
LVL 23

Expert Comment

by:Rajkumar Gs
ID: 34224457
Sure. :)

Raj
0
 
LVL 23

Expert Comment

by:Rajkumar Gs
ID: 34237078
Glad to help you :)

Raj
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question