Tuesday, 24 April 2018

Find row index inside girdview row click on checkbox using jquery

//////////////////////// HTML

<asp:GridView runat="server" ID="grdclaimdetails">
            <Columns>
                <asp:TemplateField>
                    <ItemTemplate>
                        <asp:CheckBox runat="server" ID="Personal" onclick="return getRowIndexVal(this);" />
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>



/////////////////////////js


  <script>
        function getRowIndexVal(Personal) {
            var rc = $('[id$=hdnrc]').val();
            var op1 = $(Personal).attr("id");
            var row = Personal.parentNode.parentNode.parentNode;
            var i = row.rowIndex; //  - 1;
            $('[id$=grdclaimdetails] tr').eq(i + 1).find("td").eq(7).find("input:text[id$=txtcperdiemamt]").val(pval);//value of textbox at cell 7
        }
    </script>

No comments:

Post a Comment

How to highlight selected text in notepad++

  –> To highlight a block of code in Notepad++, please do the following steps step-1  :- Select the required text. step-2  :- Right click...