I wrote compare validator for today date like below.i tried below code.

<asp:CompareValidator ID="cmp1" runat="server" ControlToValidate="FromDate" ErrorMessage="From date should be less than or equal to today date"
                     Operator="LessThanEqual" Type="Date" ValidationGroup="Submit"></asp:CompareValidator>

 cmp1.ValueToCompare = DateTime.Now.Date.ToShortDateString();

in .cs page. But its giving error like The value '' of the ValueToCompare property of 'cmp1' cannot be converted to type 'Date' in Internetexplorer 11 version.is there any way to solve this problem... Thanks in advance...

1

There are 1 answers

0
Sandeep Ray On

if it is a compatibility issue then you can modify your page directive as this.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="somecodebehind" ClientTarget="uplevel" Inherits="somecode" %>

Notice ClientTarget="uplevel" is added.