How to remove extra spaces in Blazor DataGrid?

Answer:

By applying white-space property as pre-wrap to the grid cells, the white space automatically removed in Grid will be fixed. Here is the code snippet for your reference,

SfGrid TValue="Fruit" DataSource="_fruits" RowHeight="35">

<GridColumns>

<GridColumn Field="Id" HeaderText="Fruit ID">GridColumn>

<GridColumn Field="Name" HeaderText="Fruit name" />

<GridColumn Field="InStock" HeaderText="In stock ?" />

GridColumns>

SfGrid>

<style>

td.e-rowcell {

white-space: pre-wrap !important;

}

style>


Find the Sample for spaces removed automatically in Grid here.


Loader.
Up arrow icon