In SfDataGrid, while resizing the parent grid column, the DetailsViewDataGrid’s corresponding column is not resized, even if both the parent grid and the DetailsViewDataGrid have the same number of columns. When you want to resize the DetailsViewDataGrid’s columns while resizing the parent grid columns, you can do so with the help of SfDataGrid.DetailsViewLoading event and SfDataGrid.ResizingColumns event of SfDataGrid as shown in the following code examples.
In DetailsViewLoading event, the DetailsViewDataGrid columns width has been set based on the parent grid’s column width. When the parent grid has nested levels, you need to use SfDataGrid.DetailsViewLoading event for all levels. Refer the attached sample for nested level.
In ResizingColumns event, based on new width, after resizing the parent grid column, DetailsViewDataGrid’s column width is set.
Note: In the above examples, GridHelperClass methods are used for resolving Row and Column index in both parent grid and DetailsViewDataGrid.
By default, parent grid and DetailsViewDataGrid have some space in between, since SfDataGrid.DetailsViewPadding is set. For displaying parent grid and DetailsViewDataGrid in the same line, you need to set DetailsViewPadding as 0, as shown in the following code example.
Note: By using the above examples, you can resize the parent grid and the DetailsViewDataGrid columns at the same time, if both the grids have equal number of columns only. It is applicable for nested levels also. The following links contain samples for both single level and nested level DetailsViewDataGrid.
This page will automatically be redirected to the sign-in page in 10 seconds.