In SfDataGrid, the property allows you to specify the column width, based on the data present in the cell and available width. You can define the ColumnSizer property either in the SfDataGrid or Column level.
When you change the ColumnSizer at run time, the column width is calculated based on the type of ColumnSizer.
The following screenshot displays the SfDataGrid loaded with few columns of default width (150) and rest of the widths are set explicitly,
Figure 1: Default View
Implement the following, before changing the ColumnSizer.
You can achieve the above using the following code example.
After changing the ColumnSizer as Auto at runtime, the SfDataGrid’s Columns width is calculated based on the Auto column sizer as illustrated in the following screenshot.
Figure 2: After changing the ColumnSizer as Auto
When you want to retain the column width that was loaded before the ColumnSizer changes, you can achieve it by using the stored List as illustrated in the following code example.
The above code example restores the old width of the columns that is illustrated in the following screenshot.
Figure 3: Restore the old width to Columns
|Article ID:||Published Date:||Last Revised Date:||Platform:||Control:||.NET Framework:|
or the page will be automatically redirected to sign-in page in 10 seconds.