473,385 Members | 1,861 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Need help to solve the error

Ajay Bhalala
119 64KB
Hello all,

I have create one application of RangeValidator Control in asp.net

Here my HTML view :
Expand|Select|Wrap|Line Numbers
  1. <%@ Page Language="VB" AutoEventWireup="false" CodeFile="RangeValidator_Control.aspx.vb" Inherits="RangeValidator_Control" %>
  2.  
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4.  
  5. <html xmlns="http://www.w3.org/1999/xhtml">
  6. <head runat="server">
  7.     <title>Demo of Range Validator</title>
  8. </head>
  9. <body>
  10.     <form id="form1" runat="server">
  11.     <div>
  12.         <table>
  13.             <tr>
  14.                 <td colspan="3">
  15.                     <h2>Demo of RangeValidator</h2>
  16.                 </td>
  17.             </tr>
  18.  
  19.             <tr>
  20.                 <td>FName</td>
  21.  
  22.                 <td>
  23.                     <asp:TextBox ID="txtFname" runat="server"></asp:TextBox>
  24.                 </td>
  25.  
  26.                 <td>&nbsp;</td>
  27.             </tr>
  28.  
  29.             <tr>
  30.                 <td>MName</td>
  31.  
  32.                 <td>
  33.                     <asp:TextBox ID="txtMname" runat="server"></asp:TextBox>
  34.                 </td>
  35.  
  36.                 <td>
  37.                     <asp:RangeValidator ID="valgMname" runat="server" ErrorMessage="RangeValidator" ControlToValidate="txtMname" MaximumValue="z" MinimumValue="a">Enter valid character</asp:RangeValidator>
  38.                 </td>
  39.             </tr>
  40.  
  41.             <tr>
  42.                 <td>Age</td>
  43.  
  44.                 <td>
  45.                     <asp:TextBox ID="txtAge" runat="server"></asp:TextBox>
  46.                 </td>
  47.  
  48.                 <td>
  49.                     <asp:RangeValidator ID="valgAge" runat="server" ErrorMessage="RangeValidator" ControlToValidate="txtAge" MaximumValue="25" MinimumValue="18" SetFocusOnError="true" Type="Integer">Enter age &gt;18 and &lt;25</asp:RangeValidator>
  50.                 </td>
  51.             </tr>
  52.  
  53.             <tr>
  54.                 <td>Date of Next Lecture</td>
  55.  
  56.                 <td>
  57.                     <asp:TextBox ID="txtDONL" runat="server"></asp:TextBox>
  58.                 </td>
  59.  
  60.                 <td>(mm/dd/yy)
  61.                     <asp:RangeValidator ID="valgCal" runat="server" ErrorMessage="RangeValidator" ControlToValidate="txtDONL" SetFocusOnError="true" Type="Date" >Date should be within 5 days</asp:RangeValidator>
  62.                 </td>
  63.             </tr>
  64.  
  65.             <tr>
  66.                 <td colspan="3">
  67.                     <asp:Button ID="btnSubmit" runat="server" Text="Submit" CausesValidation="true" />
  68.                     <asp:Button ID="btnClear" runat="server" Text="Clear" CausesValidation="false" />
  69.                 </td>
  70.             </tr>
  71.         </table>
  72.     </div>
  73.     </form>
  74. </body>
  75. </html>
  76.  

Here is my Design View

Demo of RangeValidator
FName txtFname
MName txtMname Enter valid character
Age txtAge Enter age >18 and <25
Date of Next Lecture txtDONL (mm/dd/yy)Date should be within 5 days

btnSubmit btnClear


Here is the Coding View
Expand|Select|Wrap|Line Numbers
  1. Partial Class RangeValidator_Control
  2.     Inherits System.Web.UI.Page
  3.  
  4.     Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
  5.  
  6.     End Sub
  7.  
  8.     Protected Sub btnClear_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnClear.Click
  9.         txtFname.Text = ""
  10.         txtMname.Text = ""
  11.         txtAge.Text = ""
  12.         txtDONL.Text = ""
  13.     End Sub
  14.  
  15.     Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  16.         If Not Page.IsPostBack Then
  17.             valgCal.MinimumValue = CDate(Now.Date)
  18.             valgCal.MaximumValue = CDate(Now.AddDays(5).Date)
  19.             valgCal.Type = ValidationDataType.Date
  20.         End If
  21.     End Sub
  22. End Class
  23.  
I have write as above in different views, but there is an error occured.

The error is as following
Error :
Expand|Select|Wrap|Line Numbers
  1. Server Error in '/Assignment1' Application.
  2.  
  3. The value '25-Sep-15' of the MaximumValue property of 'valgCal' cannot be converted to type 'Date'.
  4.  
  5. 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. 
  6.  
  7. Exception Details: System.Web.HttpException: The value '25-Sep-15' of the MaximumValue property of 'valgCal' cannot be converted to type 'Date'.
  8.  
  9. Source Error: 
  10.  
  11. 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.
  12.  
  13. Stack Trace: 
  14.  
  15.  
  16. [HttpException (0x80004005): The value '25-Sep-15' of the MaximumValue property of 'valgCal' cannot be converted to type 'Date'.]
  17.    System.Web.UI.WebControls.RangeValidator.ValidateValues() +1078735
  18.    System.Web.UI.WebControls.RangeValidator.ControlPropertiesValid() +12
  19.    System.Web.UI.WebControls.BaseValidator.get_PropertiesValid() +21
  20.    System.Web.UI.WebControls.BaseValidator.OnPreRender(EventArgs e) +27
  21.    System.Web.UI.Control.PreRenderRecursiveInternal() +80
  22.    System.Web.UI.Control.PreRenderRecursiveInternal() +171
  23.    System.Web.UI.Control.PreRenderRecursiveInternal() +171
  24.    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842
  25.  
  26. Version Information: Microsoft .NET Framework Version:2.0.50727.6387; ASP.NET Version:2.0.50727.6387   
  27.  
Please help me to solve this error. Which changes I have to do in my code????

Please help me
Sep 20 '15 #1
1 1398
Ajay Bhalala
119 64KB
Please anyone suggest me how to solve this error!!!
Sep 28 '15 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Erland | last post by:
Hi all, I have made an ASP.NET 1.1 application on windows 2000 advanced server. In the application, i have saved the file using the following code string str; str="this is my data";...
1
by: rocksoft | last post by:
Hi, i got error "class not registered" when i try to create web setup and deployment project to my web application. i'm used Asp.net and c# to my application, i created web setup and deployment...
5
by: mickey22 | last post by:
Hi, I am getting some errors in building my project I tried to build a C++ file say abc.cpp and I have put the all the directories to include necessary library files and header files..But I...
2
by: Holger.Rostalski | last post by:
hello i have an very old code here, wich worked long time very well. but now i 've got a bugreport that there is a problem with "nan" for delta_sigma. in my code is a very long math-calculation...
0
by: winbala | last post by:
Hi, I am having problem creating new project using VS.Net 2003. Whenever I am trying to create new project (any type) it shows error message "Error writing the project file. Error loading...
1
by: sana krishna | last post by:
Hai, Pls anyone help me........................... I am using ASP.NET(C#). I want to display the data in a gridview and make the gridview to become editable and insert and delete. But i can't...
0
by: dbphydb | last post by:
Hi, The below code is doing the following 1. Reading the branch name and the destination from a txt file 2. Parsing thru HTML pages Basically, i want to deploy the build of the branch (supplied...
5
by: romiverma | last post by:
hi, i have used sql2000 stored procedure with 2 date parameters to create crystal report 8.5. when i am sending date parameters from vb6 and calling the report, its giving error "the specified value...
1
by: bellr120 | last post by:
I am getting an error in the following code. The error message is "The ConnectionString property has not been initialized." How can I resolve this? Protected Sub Button1_Click(ByVal sender As...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.