Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I need a Javascript function to validate a textbox for a date less then today's date. I have a simple date validation javascript function for textbox without a gridview. That is not helping me for validate a textbox inside a gridview.

What I have tried:

<%--<cc1:toolkitscriptmanager id="ToolkitScriptManager1" runat="server" enablepagemethods="true" enablepartialrendering="true" supportspartialrendering="true" combinescripts="false">--%>
<asp:ScriptManager ID="ScriptManager1" runat="server" EnableScriptGlobalization="true"
EnableScriptLocalization="true" />
<asp:hyperlink id="HyperLink1" style="Z-INDEX: 106; LEFT: 648px; POSITION: absolute; TOP: 112px"
runat="server" ImageUrl="home.gif" NavigateUrl="menu.aspx">HyperLink

<asp:Image ID="Image1" Style="z-index: 101; left: 0px; position: absolute; top: 0px;
width: 750px;" runat="server" Height="96px" ImageUrl="images/head2.gif">
<asp:Label ID="Label1" Style="z-index: 102; left: 304px; position: absolute; top: 104px"
runat="server" Font-Underline="True" ForeColor="Maroon" Font-Bold="True"> Closure of Districts
<asp:GridView ID="gvDist" runat="server" AutoGenerateColumns="False" DataKeyNames="dist_cd"
Height="148px" Width="480px" Font-Size="Small" BorderWidth="1px"
OnItemCommand="itemrow" CellPadding="3" BorderColor="#CCCCCC" BackColor="White"
BorderStyle="None">
<columns>
<asp:TemplateField HeaderText="S.no.">
<itemtemplate>
<asp:Label ID="lblRowNumber" Text='<%# Container.DataItemIndex + 1 %>' runat="server" />


<asp:BoundField DataField="dist_name_e" HeaderText="District" ItemStyle-Width="120px" >
<itemstyle width="120px">

<asp:BoundField DataField="start_date" HeaderText="Start Date" ItemStyle-Width="120px"
ApplyFormatInEditMode="true" SortExpression="SNAPSHOT_DATA_DATE" DataFormatString="{0:d}" >
<itemstyle width="120px">

<asp:TemplateField HeaderText="Close Date (M-DD-YY)">
<itemtemplate>
<asp:Label ID="txtDistCd" runat="server" Text='<%#Eval("dist_cd") %>' Visible="False" />
<asp:TextBox ID="txtCloseDate" runat="server" Width="80px" Text='<%#Eval("close_date", "{0:MM-dd-yyyy}")%>'>
<cc1:calendarextender id="CalendarExtender2" runat="server" targetcontrolid="txtCloseDate" onclientshown="ChangeCalendarView" popupbuttonid="imgStartDate" format="dd-MM-yyyy">

<asp:ImageButton ID="imgStartDate" runat="server" ImageUrl="~/images/calender.jpg"
Width="20px" />


<asp:TemplateField HeaderText="Click here">
<itemtemplate>
<asp:Button ID="btnEdit" runat="server" Text="Save" CommandName="Update" />



<footerstyle forecolor="#000066" backcolor="White">
<HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
<pagerstyle backcolor="White" forecolor="#000066" horizontal="">
<rowstyle forecolor="#000066">
<SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
<sortedascendingcellstyle backcolor="#F1F1F1">
<sortedascendingheaderstyle backcolor="#007DBB">
<sorteddescendingcellstyle backcolor="#CAC9C9">
<sorteddescendingheaderstyle backcolor="#00547E">
Posted
Updated 6-Dec-16 19:17pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900