Solved

ASP.NET

Posted on 2010-11-27
6
418 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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

830 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