<asp:Repeater ID="rpt" runat="server"> <ItemTemplate> <td><font color="red"><%# GetTotleCount(Eval("AdminName"), Eval("AdminId"))%></font></td> <asp:HiddenField ID="HiddenField1" runat="server" Value=‘<%# GetTotleCount(Eval("AdminName"), Eval("AdminId"))%>‘/> </ItemTemplate> </asp:Repeater> <tr> <td colspan="8" align="center">信息总计:<asp:Label ID="labeltotal" runat="server" Text=""></asp:Label></td> </tr> int s = 0; for (int i = 0; i < rpt.Items.Count; i++) { HiddenField hidd = (HiddenField)rpt.Items[i].FindControl("HiddenField1"); s = s + int.Parse(hidd.Value); } labeltotal.Text = s.ToString();
时间: 2024-10-07 17:22:59