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.
First in my application I don't need to bound the grid to any DataSource but at some point when I do that, the columns width is not reflecting the text length in the cells(I need some AutoResize).
Thank you,
Ionut Balas
ADAdministrator Syncfusion Team September 24, 2003 08:40 AM UTC
If you want to autosize the columns to fit the text, you can call the ResizeToFit member of the ColWidths class. You can pass in any range you want to resize. This code does the whole table.
grid.ColWidths.ResizeToFit(GridRangeInfo.Table(), GridResizeToFitOptions.IncludeHeaders);
- Or -
you could pass in only the visible cells range (
this.gridDataBoundGrid1.ViewLayout.VisibleCellsRange)
You might also need to set gridDataBoundGrid1.AllowResizeToFit = False.
If AllowResizeToFit is true, then the grid tries to autosize the columns based on the with of their header texts. This might interfere with the explicit sizing that you are trying to do.
Stefan