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

How can I change the column width ?

I use like this : this.grdDateNames.AllowResizeToFit =false; this.grdDateNames.Model.ColWidths[0] = 250;//this.grdDateNames.Width; grdDateNames.DataSource = dateNameVO.DateNameTable; this.grdDateNames.Model.ColStyles["name"].DropDownStyle = GridDropDownStyle.Editable; GridBoundColumn gbcDateName; gbcDateName = this.grdDateNames.Binder.InternalColumns[DateNameVO.colName]; gbcDateName.StyleInfo.CellValueType = typeof(string); gbcDateName.StyleInfo.BorderMargins.Left =60; gbcDateName.StyleInfo.HorizontalAlignment = GridHorizontalAlignment.Left; But it neither resizes the column nor shows the data. Please show me how to solve this problem.

1 Reply

AD Administrator Syncfusion Team January 25, 2005 07:40 AM UTC

>>this.grdDateNames.Model.ColWidths[0] 0 is the row header column. Is that the column whose width you are trying to set? Try setting the width on col 1 to see if that has an effect. >>this.grdDateNames.Model.ColStyles["name"].DropDownStyle In a GridDataBoundGrid, you use the GridBoundColumn.StyleInfo to set column styles, not the ColStyles collection. So, try setting these styles on the GridBoundColumn. You access teh GridBoundColumns through the grid.Binder.InternalColumns collection only if you have not explicitly added GridBoundColumns to the grid.GridBoundColumns collection either through the designer or through code.

Loader.
Live Chat Icon For mobile
Up arrow icon