I took out the min/max and put them in my pre_render and page_load. No luck.
Can anyone tell me what is f. going on?
Procrastination is the thief of time. Do it NOW and its DONE. Finished!
And then, you'll be glad its done. You'll be satisfied and happy.
Then you can smile a big smile, do a little dance and have a glass of water :)
then on the code behind you can do something like this:
Public date_test
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
date_test = DateTime.Now.ToShortDateString()
Page.DataBind()
sisieko
Member
107 Points
166 Posts
Rangevalidator Min Max Value error
Aug 09, 2008 03:36 AM|LINK
I get the error The value '' of the MinimumValue property of 'DueDateRangeValidator' cannot be converted to type 'Date'
Here's what i had:
<asp:rangevalidator id=DueDateRangeValidator runat="server"
ControlToValidate="txtDueDate" ErrorMessage="Invalid date" Display="Dynamic" Type="Date"
MinimumValue="<% #DateTime.Now.ToShortDateString() %>"
MaximumValue="1/1/2099" >
</asp:rangevalidator>
I took out the min/max and put them in my pre_render and page_load. No luck.
Can anyone tell me what is f. going on?
Procrastination is the thief of time. Do it NOW and its DONE. Finished!
And then, you'll be glad its done. You'll be satisfied and happy.
Then you can smile a big smile, do a little dance and have a glass of water :)
patelkrups
Member
500 Points
95 Posts
Re: Rangevalidator Min Max Value error
Aug 09, 2008 04:53 AM|LINK
<asp:RangeValidator ID="RangeValidator1" runat="server" ControlToValidate="TextBox1"
ErrorMessage="RangeValidator" MaximumValue="8/8/2008" MinimumValue="1/1/2008" Type="Date"></asp:RangeValidator>www.askaspdotnet.com
Ganesh@Nilgr...
Contributor
6074 Points
2354 Posts
Re: Rangevalidator Min Max Value error
Aug 09, 2008 05:09 AM|LINK
u get the error since u have given the type as "Date" and storing a string in "Minimumumvalue".
Please Mark As Answer If my reply helped you.
shweta.parik...
Member
274 Points
483 Posts
Re: Rangevalidator Min Max Value error
Aug 09, 2008 05:11 AM|LINK
hi sisieko
why dont u tried compare validator?
take two textboxes set both of this textboxes style to disply:none
nd set the text proparty of this two textboxes too min nd max length respectivaly
nd use two compare validators to compare it with your textbox.
in first compare validator set controltocompare with the first one
nd in second set it with second.
thanks
shweta
shweta
In a day when don't come across any problem -you can be sure that you are traveling in wrong path
BryianTan
Contributor
5626 Points
1083 Posts
Re: Rangevalidator Min Max Value error
Aug 09, 2008 05:19 AM|LINK
hi,
you also can try it this way
<asp:rangevalidator id=DueDateRangeValidator runat="server"
ControlToValidate="txtDueDate" ErrorMessage="Invalid date" Display="Dynamic" Type="Date"
MinimumValue="<%# date_test %>"
MaximumValue="1/1/2099" >
</asp:rangevalidator>
then on the code behind you can do something like this:
Public date_test
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
date_test = DateTime.Now.ToShortDateString()
Page.DataBind()
end sub
MCP, MCAD, MCTS
My blog...
Ganesh@Nilgr...
Contributor
6074 Points
2354 Posts
Re: Rangevalidator Min Max Value error
Aug 09, 2008 05:28 AM|LINK
here is the solution.
aspx page
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <asp:RangeValidator ID="RangeValidator1" runat="server" ControlToValidate="TextBox1" ErrorMessage="RangeValidator">invalid date</asp:RangeValidator> <asp:Button ID="Button1" runat="server" Text="Button" /> codebehind protected void Page_PreRender(object sender, EventArgs e){
RangeValidator1.MinimumValue = DateTime.Now.Date.ToString("dd-MM-yy");RangeValidator1.MaximumValue =
DateTime.Now.Date.AddYears(90).ToString("dd-MM-yy");}
By default i use the type as "string" . and u should enter the date in the above format as "dd-MM-yy"
please check the following post to clarify
http://forums.asp.net/t/1287771.aspx?PageIndex=2
Please Mark As Answer If my reply helped you.