Click here to Skip to main content
15,887,291 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
ASP.NET
If I have One repeater like this

<pre lang="HTML"><asp:HiddenField ID="hdnRptItemCount" runat="server" /> <asp:Repeater ID="rptPayment" runat="server" ItemDataBound="rptPayment_ItemDataBound">                                <ItemTemplate>         
<li>
 <b><asp:Label runat="server" Text='<%#Eval("MonthName")%>' ID="lblmonthname" ></asp:Label> </b>
</li>
 <asp:GridView ID="gvPayment" runat="server" AutoGenerateColumns="false" ShowFooter="true"       OnRowDataBound="gvPayment_RowDataBound">
 <Columns>
                                        <asp:TemplateField HeaderText="Quantity to be Lifted(A)" ItemStyle-HorizontalAlign="Right"
                                                ItemStyle-Width="70px" FooterStyle-HorizontalAlign="Right" FooterStyle-Width="70px">
                                                <ItemTemplate>
                                                    <asp:TextBox ID="txtQty" runat="server" Width="70px" Text="0.00000" MaxLength="11" Style="text-align: right">
                                                    </asp:TextBox>
                                                </ItemTemplate>
                                                <FooterTemplate>
                                                    <table width="75px">
                                                        <tr valign="top">
                                                            <td> <asp:TextBox ID="txtTtlQty" runat="server" Width="70px" Text="0.00000" BorderWidth="0" 
                                                                Style="text-align: right">
                                                            </asp:TextBox>
                                                                 <%--   <asp:Label runat="server" ID="lblTtlQty" Text="0.00"></asp:Label>--%>
                                                         </td>
                                                        </tr>
                                                        <br />
                                                        <br />
                                                        <tr>
                                                        </tr>
                                                    </table>
                                                </FooterTemplate>
                                            </asp:TemplateField>
                                           <asp:TemplateField HeaderText="Cartage & Service Charges (E)" ItemStyle-HorizontalAlign="Right"
                                                FooterStyle-HorizontalAlign="Right" ItemStyle-Width="70px" FooterStyle-Width="70px">
                                                <ItemTemplate>
                 <asp:Label runat="server" ID="lblCart" Text="0.0"></asp:Label>
                                                </ItemTemplate>
                                                <FooterTemplate>
                                                    <table width="75px">
     
                                                        <tr>
                                                           <td>
                                                            <asp:Label runat="server" ID="lblGTCart" Text="0.00"></asp:Label>
                                                        </td></tr>
                                                    </table>
                                                </FooterTemplate>
                                            </asp:TemplateField>
                                            
                                        </Columns>
                                    </asp:GridView>
                                </ItemTemplate>
                            </asp:Repeater>
                        
</pre>
suppose repeater has two gridview then value of  hdnRptItemCount is 2
in javascript<pre lang="Javascript">
function grandTotal(rowId, rowIndex)
        {
           
         
            var rptItem = parseInt(document.getElementById("ContentPlaceHolder1_hdnRptItemCount").value) - 1;
            alert(rptItem);
            for (var i = 0; i <= rptItem; i++)
            {
                            
               arTcar[i] = parseFloat(document.getElementById("ContentPlaceHolder1_rptMonth_gvPayment_" + i + "_lblGTCart").innerHTML);
                


            }
          
            return true;
        }
</pre>
but in nested repeater it does not work
Posted

1 solution

 
Share this answer
 
Comments
Member 7909353 3-Dec-15 23:48pm    
I want to get control in javascript.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900