Asp.net mvc 基础设施隐藏列更新
我正在实体框架代码第一个MVC项目中使用基础设施。我想显示一个带有隐藏列(ID)的表,它必须是可编辑的。以下是我到目前为止得到的信息:Asp.net mvc 基础设施隐藏列更新,asp.net-mvc,razor,infragistics,ignite-ui,iggrid,Asp.net Mvc,Razor,Infragistics,Ignite Ui,Iggrid,我正在实体框架代码第一个MVC项目中使用基础设施。我想显示一个带有隐藏列(ID)的表,它必须是可编辑的。以下是我到目前为止得到的信息: <table id="igTests"></table> @(Html.Infragistics().Grid<BusinessModel.VO.TestVO>().ID("igTests") .AutoGenerateColumns(false) .Columns(column => {
<table id="igTests"></table>
@(Html.Infragistics().Grid<BusinessModel.VO.TestVO>().ID("igTests")
.AutoGenerateColumns(false)
.Columns(column =>
{
column.For(x => x.TestId).DataType("int").HeaderText("id");
column.For(x => x.TestNum).DataType("int").HeaderText("Test num");
column.For(x => x.Type).DataType("string").HeaderText("Type");
column.For(x => x.Nature).DataType("string").HeaderText("Nature");
column.For(x => x.TeamName).DataType("string").HeaderText("Team");
column.For(x => x.CreateDate).DataType("date").HeaderText("Creation date");
})
.Features(feature => {
feature.Sorting().CaseSensitive(true);
feature.Filtering().Mode(FilterMode.Simple);
})
.PrimaryKey("TestId")
.DataSource(Model.TestsVO.AsQueryable())
.DataBind()
.Render())
并隐藏我的ID列:
column.For(x => x.TestId).DataType("int").HeaderText("id").Hidden(true);
这是我得到的。如您所见,该表的行为就像我的ID列是可见的
这是在我添加更新功能时发生的。您知道我如何修复“添加新行”行,使其看起来像我的列一样可见吗?提前感谢。我使用
.Width(“0px”)
和“我的ID”列上的ReadOnly使其工作。有点脏,但别无选择……也许你应该加上这个
}).Features(features => features.Hiding()
.ColumnSettings(settings =>
{
settings.ColumnSetting().ColumnKey("id").Hidden(true).AllowHiding(false)
我也尝试过这样做,问题是用户可以根据需要切换列,我不希望他这样做。奇怪的是,在上面链接的示例中,他们说
此示例演示了在网格初始化期间如何隐藏列。在本例中,“产品名称”和“标价”列隐藏在网格中,并将AllowIding设置为false。注意:在初始化期间隐藏列时,列指示符不显示,因此用户无法看到隐藏列。
添加。AllowIding(false)
解决了此问题。我编辑了你的答案:)谢谢,可能部分代码仍在剪贴板中:-)
}).Features(features => features.Hiding()
.ColumnSettings(settings =>
{
settings.ColumnSetting().ColumnKey("id").Hidden(true).AllowHiding(false)