<script type="text/javascript" language="javascript"> function showhidetextbox(c,f) { DetailsView dtlvwActiveList = (DetailsView)Page.Form.FindControl("dtlvwActiveList"); var text = document.getElementById('<%= dtlvwActiveList.FindControl("txtIIterations").ClientID %>') if (text.value == "2") { document.getElementById('<%= dtlvwActiveList.FindControl("txtInodayspost").ClientID %>').style.visibility = true; } else { document.getElementById('<%= dtlvwActiveList.FindControl("txtInodayspost").ClientID %>').style.visibility = false; } }
<asp:TemplateField HeaderText="Iterations (1x – Pre, 2x – Pre & Post, on-going)"> <ItemTemplate> <asp:Label ID="lblIterations" runat="server" Text='<%# Bind("Iterations") %>'></asp:Label> </ItemTemplate> <EditItemTemplate> <asp:TextBox ID="txtEIterations" runat="server" OnTextChanged="txtEIterations_TextChanged" MaxLength="8" Width="6%" Text='<%# Bind("Iterations") %>'></asp:TextBox> x <%--<asp:RegularExpressionValidator ID="revEIterations" runat="server" ControlToValidate="txtEIterations" ValidationExpression="[0-9\s]*" ErrorMessage="Iterations should be numeric"></asp:RegularExpressionValidator>--%> </EditItemTemplate> <InsertItemTemplate> <asp:TextBox ID="txtIIterations" onchange="showhidetextbox(this,this.form)" runat="server" MaxLength="8" Width="6%" Text='<%# Bind("Iterations") %>'></asp:TextBox> x <%-- <asp:RegularExpressionValidator ValidationGroup="InsertGroup" ID="revIIterations" runat="server" ControlToValidate="txtIIterations" ValidationExpression="[0-9\s]*" ErrorMessage="Iterations should be numeric"></asp:RegularExpressionValidator>--%> </InsertItemTemplate> <ItemStyle CssClass="DetailsViewItemStyle" /> </asp:TemplateField> <pre lang="xml"><asp:TemplateField HeaderText="No.of the days for 2x post" Visible="false"> <ItemTemplate> <asp:Label ID="lblnodayspost" runat="server" Text='<%#Bind("NoOfDays2xPost") %>'></asp:Label> </ItemTemplate> <EditItemTemplate> <asp:TextBox ID="txtEnodayspost" runat="server" MaxLength="8" Width="6%" Text='<%# Bind("NoOfDays2xPost") %>'></asp:TextBox>&nbsp; <asp:RangeValidator ID="YourERangeValidator" runat="server" ControlToValidate="txtEnodayspost" ErrorMessage="Please enter a number between 0-99" Type="Integer" MinimumValue="0" MaximumValue="99"></asp:RangeValidator> <asp:RequiredFieldValidator ID="rfvtxtEnodayspost" runat="server" ControlToValidate="txtEnodayspost" Text="" ErrorMessage="No of days 2x post is required" Display="Dynamic"></asp:RequiredFieldValidator> </EditItemTemplate> <InsertItemTemplate> <asp:TextBox ID="txtInodayspost" runat="server" MaxLength="8" Width="6%" Text='<%# Bind("NoOfDays2xPost") %>'></asp:TextBox>&nbsp; <asp:RangeValidator ID="YourIRangeValidator" runat="server" ControlToValidate="txtInodayspost" ErrorMessage="Please enter a number between 0-99" Type="Integer" MinimumValue="0" MaximumValue="99" ></asp:RangeValidator> <asp:RequiredFieldValidator ID="rfvtxtInodayspost" runat="server" ControlToValidate="txtInodayspost" Text="" ErrorMessage="No of days 2x post is required" Display="Dynamic"></asp:RequiredFieldValidator> </InsertItemTemplate> <ItemStyle CssClass="DetailsViewItemStyle" /> </asp:TemplateField></pre>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)