Solved

ASP.NET

Posted on 2010-11-27
6
422 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 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
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
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…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

695 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