lundi 27 novembre 2017

execute function when the checkbox is checked

I have below function when we check or uncheck the check box (inside the gridview) it will show the popup and other processing information..

Is there any way to execute this function only when checkbox is checked and not on unchecked condition..

below is my function

 $(document).ready(function () {
    $('#<%= gvPRCertInfo.ClientID %> input[type="checkbox"]').change(function () {

        var signValue = $(this).closest('tr').children('td:eq(4)').html();

        if (signValue == "Virtual") {

            var confirm_value = document.createElement("INPUT");
            confirm_value.type = "hidden";
            confirm_value.name = "confirm_value";

            if (confirm("you have selected virtual do u want to create a new name for this?")) {
                confirm_value.value = "Yes";
            } else {
                confirm_value.value = "No";
            }
            document.forms[0].appendChild(confirm_value);
        }
    });
});

this is my gridview

 <asp:GridView ID="gvPRCertInfo" runat="server" GridLines="None"                                                                                  
   CssClass="data responsive">
           <Columns>
          <asp:TemplateField HeaderText="Select" SortExpression="">
             <HeaderTemplate>
               <asp:CheckBox ID="chkboxSelectAll" runat="server" AutoPostBack="true" OnCheckedChanged="chkboxSelectAll_CheckedChanged" />
                </HeaderTemplate>
                   <ItemTemplate>
                    <asp:CheckBox ID="chkCert" AutoPostBack="true" ClientIDMode="Static" OnCheckedChanged="chkCert_CheckedChanged" runat="server" />
                    <input type="hidden" id="hdnCertId" runat="server" value='<%# DataBinder.Eval(Container.DataItem, "CertId") %>' />
                           </ItemTemplate>
                   </asp:TemplateField>
            <asp:BoundField DataField="CertificateID" HeaderText="Certificate ID" HeaderStyle-HorizontalAlign="Center" />

 ................
 .................

Would any one please suggest any ideas on how to execute only when i check the checkbox.. many thanks in advance




Aucun commentaire:

Enregistrer un commentaire