如何在gridview页脚中添加总计逗号

时间:2012-07-11 05:11:58

标签: c# asp.net

有谁知道如何为在asp.net c#中的网格视图页脚中显示的计算总值提供逗号?

例如:12492323

2 个答案:

答案 0 :(得分:2)

如果没有发布代码,很难准确回答您的问题。

假设在您的代码后面计算总数,而不是将总数设为total.ToString(),请改用total.ToString("N0")

答案 1 :(得分:2)

protected void grdList_RowDataBound(object sender, GridViewRowEventArgs e)
{
    if (e.Row.RowType == DataControlRowType.Footer)
    {
        Label lbl = (Label)(e.Row.FindControl("lblTotal"));
        lbl.Text = String.Format("{0:n}", Total);
    }
}
相关问题