Hide a column from a WebGrid

4

Good afternoon.

I have a WebGrid and would like to leave a column invisible. How could I do that?

This is the grid:

@{
Layout = null;
WebGrid grid = new WebGrid(Model);
}


@grid.GetHtml(columns: new [] {
grid.Column("ID_PARAMETER"),
grid.Column("CD_PARAMETER"),
grid.Column("TP_PARAMETER"),
grid.Column("DS_CONTENT"),
grid.Column("DT_UPDATE"),
grid.Column("Edit", format: @<text> @Html.ActionLink("Edit", "EDITMOBILEDATA", 
new{id = item.ID_PARAMETER})</text>),
grid.Column("Delete", format: @<text> @Html.ActionLink("Delete", "DELETEMOBILEDATA",
new {id = item.ID_PARAMETER})</text>)
})

I would like to hide the ID_PARAMETER column.

    
asked by anonymous 18.05.2015 / 17:29

1 answer

3

I have never used this component, but there is a constructor that can be used like this:

WebGrid obj = new WebGrid(Model, columnNames: new[] { "ID_PARAMETER", "CD_PARAMETER", "DS_CONTENT", "DT_UPDATE" });

The reference is here .

EDIT

Apparently not just specifying the column name. You need to define your format manually:

grid.Column("TP_PARAMETER", format: @<input type="hidden" name="TP_PARAMETER" value="@item.TP_PARAMETER"/>),
    
18.05.2015 / 17:42