<div id="gridContent">
@grid.GetHtml(tableStyle:"webGrid",
headerStyle: "header",
alternatingRowStyle:"alt",
selectedRowStyle:"select",
columns:grid.Columns(grid.Column("Name","Name",style:"description"),grid.Column("DomainName","Domain Name",style:"hide"),grid.Column("ClientID","client ID",,style:"hide")</div>
<style type="text/css">
.hide {display:none;}<style>
我正在尝试使用上面的代码隐藏列,但是列标题没有隐藏。如何隐藏列标题?
答案 0 :(得分:1)
你可以拥有类似的东西
@{
var grid = new WebGrid(Model);
@grid.GetHtml(columns: grid.Columns(grid.Column(null,null, format: @<input type="hidden" name="IDHidden" value="@item.IDHidden"/>),
grid.Column("Title", "Title")));
}
答案 1 :(得分:1)
太容易了,只需评论此部分。 就像那样
@*grid.Column( "null" ,format:@<input type="hidden" name="ID" id="ID"/>),*@
grid.Column("Description",canSort:true,header: "Description",format: @<span>
<span id="spanDescription_@item.ID">@item.Description</span>
@Html.TextBox("Description"+(int)item.ID,(string)item.Description,new{@style="display:none"})</span>),