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

Hide default header but show stacked headers

Hi,

I'm trying to dynamically create GridViews using the SfDataGrid component. Most of if works well beside one but essential issue:
I have dynamic table header templates (with colspan, header texts, etc.) coming from the DB. I managed to get this working with the Stacked Header feature. My problem now is that the default header row (showing the column binding variables -> data[0]...) is shown and I couldn't find a way to get rid of it. Setting rowheight=0 also removes the StackedHeaderRows.
Any advice on how to adjust this to my needs?

Many Thanks

Sample

3 Replies

KK Karthikraja Kalaimani Syncfusion Team December 13, 2019 11:37 AM UTC

Hi Roland,

Thanks for contacting Syncfusion support.

Your requirement to hide the header row of SfDataGrid can be achieved by setting the header row height as 0 in SfDataGrid.QueryRowHeight event.

Please refer the below code example,


 
[MainPage.cs] 
…… 
private void Sfgrid_QueryRowHeight(object sender, QueryRowHeightEventArgs e) 
        { 
            //sfgrd.GetHeaderIndex() will return index of the Header Row. 
            if (e.RowIndex == sfgrid.GetHeaderIndex()) 
            { 
                e.Height = 0; 
                e.Handled = true; 
            } 
        }
….
 
 

Sample link : https://www.syncfusion.com/downloads/support/directtrac/general/ze/DataGrid_Demo235139570.zip

We hope this helps, please let us know if need further assistance from us.

Regards, 
Karthik Raja 



RK Roland Kammerer December 13, 2019 12:07 PM UTC

Hi,

Exactly what I was looking for.
Many thanks for the great support!

Regards,
Roland


KK Karthikraja Kalaimani Syncfusion Team December 16, 2019 12:45 PM UTC

Hi Roland,
 
 
Thanks for update. We are happy that the mentioned issue has been resolved at your end.

Regards, 
Karthik Raja 


Loader.
Live Chat Icon For mobile
Up arrow icon