Solved

ASP.NET

Posted on 2010-11-27
6
413 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
  • 4
  • 2
6 Comments
 
LVL 23

Accepted Solution

by:
Rajkumar Gs earned 500 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ASP:DataGrid and how to bind to a BoundColumn 8 38
How can I use this extension method? 8 47
SQL best practice question 3 36
Adware on IIS hosted asp.net website 1 20
One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

867 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now