We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

How to add border around data grid?

Hello,

How would you go about adding a border around the data grid? 

Also, I'm trying to apply a background color to certain columns. I'm using this guide: (https://blazor.syncfusion.com/documentation/datagrid/how-to/customize-column-styles).

The background color applies, but the issue is that the color applies only to every other row in the datagrid. So Row 1 = correct color, Row 2 = white, Row 3 = correct color, Row 4 = white, and so on.


Thanks!



2 Replies

AL ali October 25, 2022 10:47 AM UTC

hi

use this style

.e-grid 
{
  bb        border-color: black;
  bo        border-width: 2px;


VN Vignesh Natarajan Syncfusion Team October 26, 2022 05:53 AM UTC

Hi Matthew,


Greetings from Syncfusion support.


@Ali – Thanks for your suggestion.


Query: “How would you go about adding a border around the data grid? 


We suspect that you want to display border between each cell in the Grid. If yes, kindly refer the below ug documentation for your reference.


https://blazor.syncfusion.com/documentation/datagrid/cell#datagrid-lines


If above solution does not match your requirements, kindly get back to us with more details. Or use the suggested provided by Mr. Ali.


Query: “I'm trying to apply a background color to certain columns. I'm using this guide:


We have already documented this topic in our UG documentation. We can achieve this requirement using CustomAttibutes property of GridColumn. Refer te below Ug documentation link for your reference


https://blazor.syncfusion.com/documentation/datagrid/cell#custom-attributes


Please get back to us if you have further queries.


Regards,

Vignesh Natarajan


Loader.
Live Chat Icon For mobile
Up arrow icon