Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove header from telerik grid (RAZOR)

I have a telerik grid showing 2 levels of details, and for the first level, I want to completely remove the header.

I tried using styles.. i.e.:

                     column.Bound(x => x.Name)
                         .ClientTemplate("<#= Name#>")
                         .HeaderHtmlAttributes( new { style="display:none;"})

But I still get a "gray header thing" over the expand pluse, and it still shows an anoying white layer...

enter image description here How to completely remove it?

like image 331
scoob Avatar asked Jul 03 '26 02:07

scoob


1 Answers

Nevermind that, I found a solution although would have prefered to do it via razor than do it through a jquery/javascript hack, but with Telerik, you got to expect that!

Seems a telerik grid's header is wrapped in a thead element with a t-grid-header css class.

The styles you apply to a column with column.Bound(...).HeaderHtmlAttributes are only applied to the th element of the thead.

I just added this at the end of my .cshtml file and the header was gone.

<script type="text/javascript">
    $(".t-grid-header").css('display', 'none');
</script>
like image 107
scoob Avatar answered Jul 04 '26 16:07

scoob



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!