是这样的 我的GridView 列是自动产生的
也就是说我这个AutoGenerateColumns="true"属性设置为true了现在我想格式化里面的某列的值为小数点后2位就可以了
请教高手 如何处理

解决方案 »

  1.   

    好说,在DATABOUND里改就行了。我常用的。
      

  2.   

    "{0:N2}"
    在databound里设置列值
    http://www.cnblogs.com/seaven/articles/1298867.html
      

  3.   

        protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                e.Row.Cells[第几列].Text = Convert.ToDecimal(e.Row.Cells[第几列].Text).ToString("n2");
            }
        }
      

  4.   

    呵错了。。一样的都是放DataFormatString这里。
      

  5.   

    DataFormatString 这个好象在后台不行
    因为我的列是自动生成的