The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
Hi,
I filled a ds with dataadaptor and then use the table as the datasource for the databoundgrid. I would like to remove the most left column which has nothing and not even part of my table.
I used similar codes I used earlier to set column[0]=0 but it does not work.
Did I do something wrong?
Thanks for the help
Chris
SqlDataAdapter da;
DataSet ds = new DataSet("myData");
string sql = ...
//Initialize data adapter
da = new SqlDataAdapter(sql,dbConn);
int i = da.Fill(ds);
this.gridDataBoundGrid1.DataSource = ds.Tables[0];
this.gridDataBoundGrid1.EnableEdit=false;
this.gridDataBoundGrid1.Model.ColWidths.ResizeToFit(GridRangeInfo.Rows(0, 2), GridResizeToFitOptions.IncludeHeaders);
/minimize the index column
this.gridDataBoundGrid1.Model.ColWidths[0] = 0;
ADAdministrator Syncfusion Team January 21, 2004 12:43 PM UTC
One comment is that ColWidths[0] is actually teh RowHeader column. It is not the first column from your datasource, ColWidths[1] is.
Also, you should set
this.grid.AllowResizeToFit = false;
otherwise, the grid will try to autosize things based on headertext and this can step on your explicit sizing.