Sajid Khan

Sajid Khan

  • NA
  • 56
  • 11.4k

How to validate textbox inside gridview using javascript

Dec 7 2016 1:01 AM
How to Validate textbox for a date(greater then today) inside gridview using jscript?
 
<body>
<form id="form1" runat="server">
<%--<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:hyperlink>
<table style="height: 500px; width: 450px" >
<tr>
<td class="style5">
<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:Image>
</td>
</tr>
<tr>
<td>
<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:Label>
</td>
</tr>
<tr>
<td>
<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" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="dist_name_e" HeaderText="District" ItemStyle-Width="120px" >
<ItemStyle Width="120px"></ItemStyle>
</asp:BoundField>
<asp:BoundField DataField="start_date" HeaderText="Start Date" ItemStyle-Width="120px"
ApplyFormatInEditMode="true" SortExpression="SNAPSHOT_DATA_DATE" DataFormatString="{0:d}" >
<ItemStyle Width="120px"></ItemStyle>
</asp:BoundField>
<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}")%>'></asp:TextBox>
<cc1:CalendarExtender ID="CalendarExtender2" runat="server" TargetControlID="txtCloseDate"
OnClientShown="ChangeCalendarView" PopupButtonID="imgStartDate" Format="dd-MM-yyyy" >
</cc1:CalendarExtender>
<asp:ImageButton ID="imgStartDate" runat="server" ImageUrl="~/images/calender.jpg"
Width="20px" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Click here">
<ItemTemplate>
<asp:Button ID="btnEdit" runat="server" Text="Save" CommandName="Update" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
<FooterStyle ForeColor="#000066" BackColor="White"></FooterStyle>
<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" />
</asp:GridView>
</td>
</tr>
</table>
</form>
</body
 

Answers (3)