Search code examples
asp.net-mvc-3webgrid

How to hide header on MVC3 WebGrid


Is there some easy way to hide header for MVC3 WebGrid extension? Something like

 var grid = new WebGrid(Model, canSort:false, canPage:false, showHeader:false);

I can probably set css style for header that will cause header not showing, though I'd rather have this done via code.

Thanks,

Antonin


Solution

  • You could pass it to the GetHtml method:

    @grid.GetHtml(displayHeader: false)
    

    For additional options you may take a look at the following blog post.