if (!IsPostBack)
{
GridViewDataTextColumn[] colTotal = new GridViewDataTextColumn[2];//添加列标题
string[] ss = new string[18] { " 编码", " 名称","时间" };
for (int i = 0; i < 3; i++)
{
colTotal[i] = new GridViewDataTextColumn();
colTotal[i].Caption = ss[i];
colTotal[i].FieldName = ss[i];
if (i == 2)
colTotal[i].UnboundType = DevExpress.Data.UnboundColumnType.DateTime;
ASPxGridView1.Columns.Add(colTotal[i]);
}
}
//如果列很多,又希望在拖动水平滚动条时能够看见第一列或第二列,那么就添加一下语句
ASPxGridView1.Columns[" 编码"].FixedStyle = DevExpress.Web.ASPxGridView.GridViewColumnFixedStyle.Left;
ASPxGridView1.Columns[" 名称"].FixedStyle = DevExpress.Web.ASPxGridView.GridViewColumnFixedStyle.Left;
ASPxGridView1.Columns["时间"].Width = 150;