【发布时间】:2014-01-06 05:27:09
【问题描述】:
我有一个汇总列,编码如下:
private void radGridView1_Initialized(object sender, EventArgs e)
{
this.radGridView1.SummaryRowsBottom.Add(new GridViewSummaryRowItem(new GridViewSummaryItem[]{
new GridViewSummaryItem("Balance", "{0}", GridAggregateFunction.Sum)}));
this.radGridView1.MasterTemplate.ShowTotals = true;
this.radGridView1.MasterView.SummaryRows[0].PinPosition = PinnedRowPosition.Top;
}
private void radGridView1_ViewCellFormatting(object sender, CellFormattingEventArgs e)
{
if (e.CellElement is GridSummaryCellElement)
{
e.CellElement.TextAlignment = ContentAlignment.MiddleRight;
Font summaryFont = new Font("Segoe", 9, FontStyle.Bold);
e.CellElement.Font = summaryFont;
}
}
我需要像我在设计器中修改的其他列一样格式化此列。
{0:R #.##,##}
如何在上述上下文中实现这种格式的字符串?
更新 我在这一行尝试了一些东西,但编译器给出错误,说字符串格式只能是“G”、“g”、“X”、“x”、“F”、“f”、“D”o“d”如果我尝试其中之一,则会收到错误“未管理目标调用错误”。
new GridViewSummaryItem("Balance", "{0}", GridAggregateFunction.Sum.ToString("R #.##,##"))}));
【问题讨论】:
标签: c# winforms telerik radgridview