How to hide header on MVC3 WebGrid

浪尽此生 提交于 2019-12-10 19:12:58

问题


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


回答1:


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.




回答2:


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

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



回答3:


Use this code to hide column with its header Value: WebGrid

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



回答4:


If you are trying to hide the header but still show the column of data just make the header a single blank space:

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


来源:https://stackoverflow.com/questions/4714384/how-to-hide-header-on-mvc3-webgrid

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!