Grid header different styles

Hi guys, It is possible to have different header styles from two different grids on the same page?

I would like to show one grid with a header on gray and the other one with the header on blue.


3 Replies

RN Rahul Narayanasamy Syncfusion Team January 21, 2022 01:20 PM UTC

Hi Luis, 

Greetings from Syncfusion. 

Query: It is possible to have different header styles from two different grids on the same page? I would like to show one grid with a header on gray and the other one with the header on blue. 

You want to set different header color for the Grids which is present in the same page. You can achieve your requirement by using CSS. Find the below code snippets for your reference. 

 
<SfGrid ID="Grid1" DataSource="@Orders" AllowPaging="true"> 
    <GridPageSettings PageSize="5"></GridPageSettings> 
    <GridColumns> 
        . . . 
    </GridColumns> 
</SfGrid> 
 
<SfGrid ID="Grid2" DataSource="@Orders" AllowPaging="true"> 
    <GridPageSettings PageSize="5"></GridPageSettings> 
    <GridColumns> 
        . . . 
    </GridColumns> 
</SfGrid> 
 
@code{ 
    . . . 
} 
 
<style> 
    #Grid1.e-grid th.e-headercell { 
        background-color: gray; 
    } 
    #Grid2.e-grid th.e-headercell { 
        background-color: blue; 
    } 
</style> 

You can customize the Grid appearance by using below documentation. Find the below link for your reference. 


Please let us know if you have any concerns. 

Regards. 
Rahul  



LR Luis Roberto January 21, 2022 02:48 PM UTC

Thank you very much Rahul, it worked perfectly.


Take care.



RN Rahul Narayanasamy Syncfusion Team January 24, 2022 05:48 AM UTC

Hi Luis, 
 
Thanks for the update. 
 
We are happy to hear that the provided solution was helpful to achieve your requirement. Please get back to us if you need further assistance. 
 
Regards, 
Rahul 


Loader.
Up arrow icon