asp.net - How to validate a textbox value based on another textbox value inside gridview in jquery -


i have 2 textbox inside gridview. if 1st text contains data 2nd textbox should not empty. if 1st textbox null no validation 2nd textbox. alert come after filling 1st textbox 2nd textbox shouldn't empty. how that?

any idea? please 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 when user fills txttestcasecount must have fill txthours

can check onfoucsout event  $("textbox2id").focusout(function(){ if(!($("textbox2id").val() == "")) { alert("please enter value required"); $(this).focus(); } }) 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -