We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Cannot Minimize column size

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;

1 Reply

AD Administrator 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.

Loader.
Live Chat Icon For mobile
Up arrow icon