gridControl控件動態綁定列

            DataTable dt = =Query.GetCustome=(ref customColumnCount);
            
            //綁定列
            gridView.Columns.Add(new GridColumn() { Name = "NoCHK", FieldName = "NoCHK", Caption = "選擇", VisibleIndex =0});
            gridView.Columns.Add(new GridColumn() { Name = "No", FieldName = "No", Caption = "No", Visible = false });
            gridView.Columns["TestNo"].OptionsColumn.AllowEdit = false;
            gridView.Columns.Add(new GridColumn() { Name = "NAME", FieldName = "NAME", Caption = "名稱", VisibleIndex=2 });
            gridView.Columns["NAME"].OptionsColumn.AllowEdit = false;
gridControl.DataSource = dt;
            //自動列寬,會出現橫向滾動條
            gridView.OptionsView.ColumnAutoWidth = false;
            
            //自動列寬
            gridView.BestFitColumns();

動態綁定GridControl列,已做記錄。spa

VisibleIndex =0這個要有的,若是沒有就不會顯示,若是顯示或不顯示,能夠這樣作
相關文章
相關標籤/搜索