forum

Home / DeveloperSection / Forums / How to validate a textbox value based on another textbox value inside gridview in jquery

How to validate a textbox value based on another textbox value inside gridview in jquery

Anonymous User 2167 26-Nov-2014

I have two textbox inside grid view.If 1st text contains any data den 2nd textbox shouldnot empty.If 1st textbox is null den no validation for 2nd textbox.Only the alert will come after filling the 1st textbox 2nd textbox shouldn't empty. How to do that 

Any idea? Please help me out

 
<asp:GridView runat="server" Width="980px" ID="grdResUpdate" AutoGenerateColumns="false"
                                                    CssClass="TopMargin10 borderClass gridwrap" OnRowDataBound="grdResUpdate_RowDataBound" ShowHeader="true">
                                                    <Columns>
                                                        <asp:TemplateField HeaderText="SO #" ItemStyle-Width="70px">
                                                            <ItemTemplate>
                                                               <asp:Label runat="server" Width="70px" ID="lblSOName" CssClass="gridwrap" Text='<%# Eval("SOName")%>' />
                                                               <asp:HiddenField runat="server" ID="hdnFldSOId" Value='<%#Eval("SOId") %>' />
                                                            </ItemTemplate>
 
                                                        </asp:TemplateField>
                                                        <asp:TemplateField HeaderText="Test Type" ItemStyle-Width="300px" ItemStyle-VerticalAlign="Top">
                                                            <ItemTemplate>
                                                                <asp:HiddenField runat="server" ID="testTypeIdHdnFld" Value='<%#Eval("TestTypeId") %>' />
                                                                <asp:Label runat="server" Width="150px" ID="lblTestTypeName" CssClass="gridwrap" Text='<%# Eval("TestTypeName")%>' />
                                                            </ItemTemplate>
                                                        </asp:TemplateField>
                                                        <asp:TemplateField HeaderText="Test Case Count" ItemStyle-Width="100px" ItemStyle-VerticalAlign="Top">
                                                            <ItemTemplate>
                                                                <asp:TextBox ID="txtTestCaseCount" runat="server" HeaderText="Test Case Count" Width="80px" onkeydown="return isDigit(event)"></asp:TextBox>
                                                            </ItemTemplate>
                                                        </asp:TemplateField>
                                                        <asp:TemplateField HeaderText="Environment" ItemStyle-Width="100px" ItemStyle-VerticalAlign="Top">
                                                            <ItemTemplate>
                                                                <asp:TextBox ID="txtEnvironment" runat="server" HeaderText="Environment" Width="80px" onkeydown="return isDigit(event)"/>
                                                            </ItemTemplate>
                                                        </asp:TemplateField>
                                                        <asp:TemplateField HeaderText="Passed" ItemStyle-Width="100px" ItemStyle-VerticalAlign="Top">
                                                            <ItemTemplate>
                                                                <asp:TextBox ID="txtPassed" runat="server" HeaderText="Passed" Width="80px" onkeydown="return isDigit(event)"></asp:TextBox>
                                                            </ItemTemplate>
                                                        </asp:TemplateField>
                                                        <asp:TemplateField HeaderText="Failed" ItemStyle-Width="70px" ItemStyle-VerticalAlign="Top">
                                                            <ItemTemplate>
                                                                <asp:TextBox ID="txtFailed" runat="server" HeaderText="Failed" Width="80px" onkeydown="return isDigit(event)"></asp:TextBox>
                                                            </ItemTemplate>
                                                        </asp:TemplateField>
                                                        <asp:TemplateField HeaderText="No Of Defects" ItemStyle-Width="70px" ItemStyle-VerticalAlign="Top">
                                                            <ItemTemplate>
                                                                <asp:TextBox ID="txtDefects" runat="server" HeaderText="No Of Defects" Width="80px" onkeydown="return isDigit(event)"></asp:TextBox>
                                                            </ItemTemplate>
                                                        </asp:TemplateField>
                                                        <asp:TemplateField HeaderText="Hours" ItemStyle-Width="100px" ItemStyle-VerticalAlign="Top">
                                                            <ItemTemplate>
                                                                <asp:TextBox ID="txtHours" runat="server" HeaderText="Hours" Width="80px" onkeydown="return isDigit(event)"></asp:TextBox>
                                                            </ItemTemplate>
                                                        </asp:TemplateField>
 
                                                        <asp:TemplateField HeaderText="Test Case Completed" ItemStyle-Width="100px" ItemStyle-VerticalAlign="Top">
                                                            <ItemTemplate>
                                                                <asp:TextBox ID="txtTCComp" runat="server" HeaderText="Test Case Completed" Width="80px" onkeydown="return isDigit(event)"></asp:TextBox>
                                                            </ItemTemplate>
                                                        </asp:TemplateField>
                                                        <asp:TemplateField HeaderText="Percentage Completed" ItemStyle-Width="100px" ItemStyle-VerticalAlign="Top">
                                                            <ItemTemplate>
                                                                <asp:TextBox ID="txtPercComp" runat="server" HeaderText="Percentage Completed" Width="80px" onkeydown="return isDigit(event)"></asp:TextBox>
                                                            </ItemTemplate>
                                                        </asp:TemplateField>
 
                                                    </Columns>
                                                    <HeaderStyle CssClass="headerTop" />
                                                    <AlternatingRowStyle CssClass="rowbgblue" />
                                                    <RowStyle CssClass="rowbginwhite" />
                                                </asp:GridView>

I want whent the user will fill the txtTestCaseCount den he must hv filled txtHours


Updated on 27-Nov-2014
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By