如何在嵌套转发器中获取gridview的元素

如何在嵌套转发器中获取gridview的元素

本文介绍了如何在嵌套转发器中获取gridview的元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

推荐答案


这篇关于如何在嵌套转发器中获取gridview的元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 00:38