How to hide header on MVC3 WebGrid

Is there an easy way to hide the header for the MVC3 WebGrid extension? Sort of

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

Perhaps I can set a CSS style for the title that does not render the title displayed, although I would prefer to do it with code.

Thanks,

Antonin

+3
source share
4 answers

You can pass it to the GetHtml method:

 @grid.GetHtml(displayHeader: false) 

You can see more options in the next blog post .

+13
source

write the column index in eq() and it will work put this in the document.ready() function

 $('.grid table thead tr th:eq(8)').hide(); 
0
source

Use this code to hide a column with your heading. Value: WebGrid

 grid.Column(null,null, format: @<input type="hidden" name="IDHidden" value="@item.IDHidden"/>), 
0
source

If you are trying to hide the header, but still see the data column, just make the header empty:

  grid.Column("Address2", header: " ", style: "cols", canSort: true) 
0
source

Source: https://habr.com/ru/post/1397812/


All Articles