Freeze panes

1 Mar 20221 minute to read

SfDataGrid allows you to freeze the rows and columns when scrolling the grid.

Freeze Rows

SfDataGrid provides extensive support to freeze the rows at the top of the view below the header row by setting the SfDataGrid.FrozenRowsCount property.

The following code example illustrates freezing two rows in SfDataGrid.

  • C#
  • //Setting number of rows to freeze in SfDataGrid
    dataGrid.FrozenRowsCount = 2;

    Limitation

    • FrozenRowsCount should be lesser than the number of rows that is displayed in View.
    • For example:
      If you have 10 rows in view, then you set FrozenRowsCount to a maximum value of 9.

    NOTE

    Header row is frozen by default and works regardless of the FrozenRowsCount property.

    Freeze Columns

    SfDataGrid also provides support to freeze the columns at the left of the view by setting the SfDataGrid.FrozenColumnsCount property.

    The following code example illustrates freezing two columns in SfDataGrid.

  • C#
  • //Setting number of columns to freeze in SfDataGrid
    dataGrid.FrozenColumnsCount = 2; 

    Limitation

    • FrozenColumnsCount should be lesser than number of columns displayed in View.
    • For example:
      If you have 5 columns in view, then you can set FrozenColumnsCount to a maximum value of 4.

    NOTE

    RowHeader is frozen by default and works regardless of the FrozenColumnsCount property.