怎么总=“sum"For templatecolumcolumns In RadGrid (Telerik)
本文关键字:In templatecolumcolumns For RadGrid Telerik quot sum | 更新日期: 2023-09-27 18:02:19
my templateccolumn In RadGrid (Telerik)如下所示:
<telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn_Benefit"
HeaderText="Benefit" UniqueName="TemplateColumn_Benefit" FilterImageToolTip="Filter">
<ItemTemplate>
<asp:Label ID="lblBenefitInsideGrd" runat="server" Font-Size="11px" Text='<%# (bool)Convert.IsDBNull(Eval("Benefit")) ? "<span class='"lblInsideGrd'">Empty</span>" : String.Format("{0:#,0 Dollar;#,0- Dollar}", Eval("Benefit")) %>'></asp:Label>
</ItemTemplate>
<HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="60px" />
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="60px" />
</telerik:GridTemplateColumn>
RadGrid的showfooter属性是true…
当将下面的属性添加到这个模板列时,我们将会有一个异常…
properties: FooterText="my sum"总="Sum"
错误消息:类型"System.Object"不支持Sum
如何在radgrid中得到这些列的和?
thanks in advance
您必须将DataField="Benefit"添加到gridtemplatecoluml
<telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn_Benefit" DataField="Benefit"
HeaderText="Benefit" UniqueName="TemplateColumn_Benefit" FilterImageToolTip="Filter">
<ItemTemplate>
<asp:Label ID="lblBenefitInsideGrd" runat="server" Font-Size="11px" Text='<%# (bool)Convert.IsDBNull(Eval("Benefit")) ? "<span class='"lblInsideGrd'">Empty</span>" : String.Format("{0:#,0 Dollar;#,0- Dollar}", Eval("Benefit")) %>'></asp:Label>
</ItemTemplate>
<HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="60px" />
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="60px" />
</telerik:GridTemplateColumn>