1. 程式人生 > >ExtAspNet中Grid改變某列的值

ExtAspNet中Grid改變某列的值

 protected void Grid1_RowDataBound(object sender, GridRowEventArgs e)
        {

            DataRowView row = e.DataItem as DataRowView;
           if (row != null)
            {
                if (e.Values[2].ToString().Length > 20)
                {
                    e.Values[2] = e.Values[2].ToString().Substring(0, 20) + "……";  // values[2]表示第三列
                }
              
            }

          
        }