[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.3

Problem with dates in user control  being handled differently on local and production server

Asked by kevinduk in .NET, MS SQL Server, MS SharePoint

Hi I have a web Part with a user control which contains several date validators.
This works fine on my development system but gives an error when moved to the production server. The odd part is that not all of the date validators cause the error.
The error I get on the production server is:

Server Error in '/' Application.
--------------------------------------------------------------------------------

The value '22-10-1991' of the MaximumValue property of 'HiddenT1DobRangeValidator' cannot be converted to type 'Date'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: The value '22-10-1991' of the MaximumValue property of 'HiddenT1DobRangeValidator' cannot be converted to type 'Date'.

Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace:
[HttpException (0x80004005): The value '22-10-1991' of the MaximumValue property of 'HiddenT1DobRangeValidator' cannot be converted to type 'Date'.]
   System.Web.UI.WebControls.RangeValidator.ValidateValues() +2046191
   System.Web.UI.WebControls.RangeValidator.ControlPropertiesValid() +16
   System.Web.UI.WebControls.BaseValidator.get_PropertiesValid() +44
   System.Web.UI.WebControls.BaseValidator.OnPreRender(EventArgs e) +38
   System.Web.UI.Control.PreRenderRecursiveInternal() +108
   System.Web.UI.Control.PreRenderRecursiveInternal() +224
   System.Web.UI.Control.PreRenderRecursiveInternal() +224
   System.Web.UI.Control.PreRenderRecursiveInternal() +224
   System.Web.UI.Control.PreRenderRecursiveInternal() +224
   System.Web.UI.Control.PreRenderRecursiveInternal() +224
   System.Web.UI.Control.PreRenderRecursiveInternal() +224
   System.Web.UI.Control.PreRenderRecursiveInternal() +224
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3394

I am using SQL 2008 for both the local and production servers both set to language English(British)  
The webpart is loaded into a sharepoint page.
I am developing in VS 2008
 
I cant figure out why Iam getting the error on the production server and whe the error that is thrown refers to HiddenT1 Maximun value when T1 maximmum and minimum values and HiddenT1 Minimum value have not caused an error.

Any help would be greatly appreciated.

Kev


1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
From control.ascx.cs    
----------------------------
 
protected void Page_PreRender(object sender, EventArgs e)
    {
       
      T1DobRangeValidator.MinimumValue = DateTime.Now.Date.AddYears(-140).ToString("dd-MM-yyyy");
      T1DobRangeValidator.MaximumValue = DateTime.Now.Date.AddYears(-18).ToString("dd-MM-yyyy");
      HiddenT1DobRangeValidator.MinimumValue = DateTime.Now.Date.AddYears(-120).ToString("dd-MM-yyyy");
      HiddenT1DobRangeValidator.MaximumValue = DateTime.Now.Date.AddYears(-18).ToString("dd-MM-yyyy");
    
      T2DobRangeValidator.MinimumValue = DateTime.Now.Date.AddYears(-140).ToString("dd-MM-yyyy");
      T2DobRangeValidator.MaximumValue = DateTime.Now.Date.AddYears(-18).ToString("dd-MM-yyyy");
      HiddenT2DobRangeValidator.MinimumValue = DateTime.Now.Date.AddYears(-140).ToString("dd-MM-yyyy");
      HiddenT2DobRangeValidator.MaximumValue = DateTime.Now.Date.AddYears(-18).ToString("dd-MM-yyyy");
 
      childDobRangeValidator.MinimumValue = DateTime.Now.Date.AddYears(-18).ToString("dd-MM-yyyy");
      childDobRangeValidator.MaximumValue = DateTime.Now.Date.ToString("dd-MM-yyyy");
 
      personDobRangeValidator.MinimumValue = DateTime.Now.Date.AddYears(-18).ToString("dd-MM-yyyy");
      personDobRangeValidator.MaximumValue = DateTime.Now.Date.ToString("dd-MM-yyyy");
    }
 
-------------------------
From Control.ascx
------------------------
<td>
                                                        <asp:TextBox ID="T1Dob" runat="server">dd/mm/yyyy</asp:TextBox>
                                                        <asp:RangeValidator ID="T1DobRangeValidator" runat="server" ValidationGroup="T1ValidationGroup"
                                                            ErrorMessage="T1 DOB Out of Range" ControlToValidate="T1Dob" Type="Date" Display="Dynamic">*</asp:RangeValidator>
                                                        <asp:RequiredFieldValidator ID="T1DOBRFValidator" runat="server" ValidationGroup="T1ValidationGroup"
                                                            ErrorMessage="Date of Birth required" ControlToValidate="T1Dob" Display="Dynamic">*</asp:RequiredFieldValidator>
                                                    </td>
 
 
 
       <asp:RangeValidator ID="HiddenT1DobRangeValidator" runat="server" ValidationGroup="T1ValidationGroup"
                        ErrorMessage="T1 DOB Out of Range" ControlToValidate="T1Dob" Type="Date" Display="Dynamic" />
                    <asp:RequiredFieldValidator ID="HiddenT1DobRFValidator" runat="server" ValidationGroup="T1ValidationGroup"
                        ErrorMessage="Date of Birth required" ControlToValidate="T1Dob" Display="Dynamic" />
[+][-]10/22/09 06:05 AM, ID: 25633627Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zones: .NET, MS SQL Server, MS SharePoint
Sign Up Now!
Solution Provided By: trax75
Participating Experts: 1
Solution Grade: A
 
 
Loading Advertisement...
20091118-EE-VQP-93 - Hierarchy / EE_QW_3_20080625