如何在devexpress gridview dynamic中删除GridViewDataTextColumn?
DevExpress.Web.GridViewDataTextColumn col1 = new DevExpress.Web.GridViewDataTextColumn() { FieldName = "col1", VisibleIndex = 16 };
DevExpress.Web.GridViewDataTextColumn col2 = new DevExpress.Web.GridViewDataTextColumn() { FieldName = "col2", VisibleIndex = 17 };
if (has)
{
grd1.Columns.Add(col1);
grd1.Columns.Add(col2);
grd1.DataBind();
}
else if (grd1.Columns.IndexOf(grd1.Columns["col1"]) != -1 && grd1.Columns.IndexOf(grd1.Columns["col2"]) != -1)
{
grd1.DataSource = null;
grd1.DataBind();
grd1.Columns.Remove(col1);
grd1.Columns.Remove(col2);
grd1.DataBind();
}