Search code examples
jqueryjqgriddata-annotationslib.web.mvc

jqgrid & Lib.Web.Mvc.JQuery.JqGrid.DataAnnotations:how hide column?


I have this jqgrid

var grid = new JqGridHelper<VisualisationModel>(
    "gridVisualizzazioni",
    caption: null,
    dataType: JqGridDataTypes.Json,      
    methodType: JqGridMethodTypes.Post,
    pager:true,
    sortingName: "IndicatoreVisualizzazioniPk",
    sortingOrder: JqGridSortingOrders.Asc,
    url: Url.Action("LoadGrid", new {
                                      indicatorePk = Model.IndicatorePk
                                    }),
    autoWidth: true,
    viewRecords: true, 
    loadComplete:"SetCellBackColor");

And in my model I create some column...

In particular

[Required]
[JqGridColumnFormatter(JqGridColumnPredefinedFormatters.Integer)]
public int AggregazioniDatiId { get; set; }

It is possible hide the above column in jqGrid by DataAnnotation?

I have tried with

[ScaffoldColumn(false)]

but in the colModel the column don't appear and then my jquery code does not work

var grid = $("#gridVisualizzazioni");
var selRowId = grid.jqGrid('getGridParam', 'selrow');
var celValue = grid.jqGrid ('getCell', selRowId, 'AggregazioniDatiId');

Thanks in advance.

Sara


Solution

  • Try this:

    [HiddenInput(DisplayValue = false)]