4

I'm using DevExpress library.

I have problem with GridControl the following property is not appear :

gridView1.Columns.Add(); // not appear why ? 

My references are:

using DevExpress.XtraGrid.Views.Base;
using DevExpress.XtraGrid.Views.Grid;
using DevExpress.XtraGrid.Columns;
Artem Kulikov
  • 2,250
  • 19
  • 32
SHADOW.NET
  • 555
  • 1
  • 5
  • 20

3 Answers3

6

Maybe you have not added references in solution explorer..

I follow the steps below:

GridColumn col=new GridColumn();
col.Caption = "Samples";
col.FieldName = "Samples";
gridView1.Columns.Add (col)
1

Try the following code

GridColumn column = gridView1.Columns.AddVisible("FieldName", string.Empty);
gridView1.Columns.Add(column);
TheGeneral
  • 79,002
  • 9
  • 103
  • 141
Dmitry Gribkov
  • 311
  • 3
  • 2
0

You should make the columns visible. try the following code:

gridView.Columns.Clear();
for (int i = 0; i < 8; i++){
               gridView1.Columns.Add(new DevExpress.XtraGrid.Columns.GridColumn());
gridView1.Columns[i].Visible = true;
}
Rayan Albouni
  • 169
  • 1
  • 5