How can i add space between Grid rows

Can you please let me know if i can add space between grid rows with Blazor and Syncfusion? If so how can i do that.. i have tried different solutions on my end but they are not working 


6 Replies

AA Adnan Ali August 18, 2023 04:18 PM UTC

I need to add spacing between grid rows,but any solution is not working for me



PS Prathap Senthil Syncfusion Team August 18, 2023 04:21 PM UTC

Hi Adnan Ali,

Query:” How can i add space between Grid rows:”

Based on your needs, we suggest you use the below CSS customization to achieve your requirements. Kindly refer to the below code snippet and sample for your reference.


 

<style >

  

    .e-content .e-table{

        border-spacing: 0px 10px; /* space between rows */

    }

   .e-grid .e-row{

           background-color:aquamarine;

        }

</style>



A screenshot of a computer

Description automatically generated


Sample Link: https://blazorplayground.syncfusion.com/embed/BZBUNbibKFDfyhcH?appbar=true&editor=true&result=true&errorlist=true&theme=bootstrap5



JC jishnu chn October 19, 2025 04:29 AM UTC

Can we add space between few rows ? like in the above image i want to add space between 2nd and 3rd row . not others.



NP Naveen Palanivel Syncfusion Team October 21, 2025 12:06 AM UTC

Hi jishnu chn,

We checked your requirement and it seems that you want to add space between a specific row instead of applying it to the entire grid. This can be achieved by using the RowDataBound event to add a custom class to the specific row. Then, you can apply the desired spacing using CSS for that class. Please refer to the code snippet and sample provided below to implement this solution.

Sample : https://blazorplayground.syncfusion.com/embed/hZLosjrMNZBwMhir?appbar=true&editor=true&result=true&errorlist=true&theme=bootstrap5

UG :
https://blazor.syncfusion.com/documentation/datagrid/row#using-event

    <GridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true"></GridEditSettings>

    <GridEvents TValue="Order" RowDataBound="RowBound"></GridEvents>

    <GridColumns>

</SfGrid>

 

<style>

 

    .e-grid tr.e-row {

        background-color: aquamarine;

    }

 

    .e-grid tr.e-row.spaced-row td {

            background-color: aquamarine;

        border-bottom : 10px solid white;

 

    }

 

</style>

 

@code {

    public List<Order> Orders { get; set; }

 

    public void RowBound(RowDataBoundEventArgs<Order> args)

    {

        if (args.Data.OrderID == 1002 || args.Data.OrderID == 1003)

        {

            args.Row.AddClass(new string[] { "spaced-row" });

        }

       

    }


Regards,
Naveen



JC jishnu chn October 23, 2025 07:11 PM UTC

Thanks for the update. I want the style in this format: each super parent and all its children should be marked with a black border(border only for super parent not its child ). Add extra space only between the super parents (not between their children) in the tree grid.


Image_5634_1761246367906



NP Naveen Palanivel Syncfusion Team October 27, 2025 05:26 PM UTC

Hi jishnu chn,

We want to inform you that we have branched a new forum for this query . For any updates or further communication regarding that particular concern, we kindly ask you to refer to the following forum:


Forum: Customizing the border style and spac... | Blazor Forums | Syncfusion®

Please use the provided forum to communicate with us about your query .Thank you for your patience and cooperation. We are committed to resolving these issues for you as quickly as possible.

Regards,
Naveen.



Loader.
Up arrow icon