I have validated it to compare that date should less then today's date , now i need to validate it for one more requirement. How to validate a calendar extender for (Close)date(must be greater then Start Date coming from database) in a gridview using jscript?
here's the code :
function CheckForBackDate(sender, args) {
var selectedDate = new Date();
selectedDate = sender._selectedDate;
var todayDate = new Date();
if (selectedDate.getDateOnly() > todayDate.getDateOnly()) {
sender._selectedDate = todayDate;
sender._textbox.set_Value(sender._selectedDate.format(sender._format));
alert("Closure date must be less then today's date");
}}
EnableScriptLocalization="true" />
runat="server" ImageUrl="home.gif" NavigateUrl="menu.aspx">HyperLink
runat="server" Font-Underline="True" ForeColor="Maroon" Font-Bold="True"> Closure of Districts |
Height="148px" Width="480px" Font-Size="Small" BorderWidth="1px" OnItemCommand="itemrow" CellPadding="3" BorderColor="#CCCCCC" BackColor="White" BorderStyle="None"> ApplyFormatInEditMode="true" SortExpression="SNAPSHOT_DATA_DATE" DataFormatString="{0:d}" > <%--Onclick=" return checkMyDate_SM1();"--%> OnClientDateSelectionChanged ="CheckForBackDate" OnClientShown="ChangeCalendarView" PopupButtonID="imgStartDate" Format="dd-MM-yyyy" > Width="20px" /> <%-- Display="Dynamic" ErrorMessage="Invalid Date" Operator="DataTypeCheck" Type="Date"> --%> <%-- Enabled="True" TargetControlID="CompareValidator1"> --%> |
1 Reply
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Mangesh GPosted Dec 7, 2016, 5:25 AM