Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jan 27, 2013 08:36 AM by francissvk
0 Points
9 Posts
Jan 26, 2013 11:49 PM|LINK
Hi. I am using VS2012 C# and IE9.
I get this error when trying validate a text box with a date in the format of 20130126.
Below is the control snippet.
<asp:CompareValidator ID="CompareValidatorDateEntered" Operator="GreaterThanEqual" Type="Date" ControlToValidate="DateEntered" ErrorMessage="Invalid date" runat="server" />
Below is page_load.
protected void Page_Load(object sender, EventArgs e)
{
CompareValidatorDateEntered.ValueToCompare = DateTime.Now.ToString("yyyymmdd");
}
Any help would be greatly appreciated.
Thank you.
Member
40 Points
16 Posts
Jan 27, 2013 02:03 AM|LINK
compare when the both values are in same formate. u need to do is just convert and then check their value
Please Use select change event or text change or value change events for this would be better that pageload
Participant
1010 Points
343 Posts
Jan 27, 2013 08:36 AM|LINK
Hi Mike,
Please check this url.
I hope this helps.
Check my blog for other validators :)
Thanks
MikeASP_NET
0 Points
9 Posts
CompareValidator does not exist in the current context
Jan 26, 2013 11:49 PM|LINK
Hi. I am using VS2012 C# and IE9.
I get this error when trying validate a text box with a date in the format of 20130126.
Below is the control snippet.
<asp:CompareValidator ID="CompareValidatorDateEntered" Operator="GreaterThanEqual" Type="Date" ControlToValidate="DateEntered" ErrorMessage="Invalid date" runat="server" />
Below is page_load.
protected void Page_Load(object sender, EventArgs e)
{
CompareValidatorDateEntered.ValueToCompare = DateTime.Now.ToString("yyyymmdd");
}
Any help would be greatly appreciated.
Thank you.
Chintalas
Member
40 Points
16 Posts
Re: CompareValidator does not exist in the current context
Jan 27, 2013 02:03 AM|LINK
compare when the both values are in same formate. u need to do is just convert and then check their value
Please Use select change event or text change or value change events for this would be better that pageload
francissvk
Participant
1010 Points
343 Posts
Re: CompareValidator does not exist in the current context
Jan 27, 2013 08:36 AM|LINK
Hi Mike,
Please check this url.
I hope this helps.
Check my blog for other validators :)
Thanks
Click "…Mark As Answer" if my reply helpful to you..
A2Z DotNet