A hidden template column that is not included in the ColumnMenu appears after showing another column
.Columns(columns =>
{
//Hidden template column
columns.Template(x =>
{
int rptIndex = Model.IndexOf(x);
string namePrefix = "Grid[" + rptIndex + "].";
Html.Hidden(namePrefix + "Id", x.Id, new { @readonly = "readonly" });
Html.Hidden(namePrefix + "Name", x.Name, new { @readonly = "readonly" });
}).Hidden().IncludeInMenu(false);
columns.Bound(x => x.Id).Width(120).Hidden(true);
columns.Bound(x => x.Name).Width(200);
columns.Bound(x => x.ReportingDateOriginal).Width(500).HtmlAttributes(new { id = "reporting-date-original" })
.Filterable(f => f.UI(GridFilterUIRole.DateTimePicker).Cell(c => c.Template("dateFilter")));
columns.Bound(x => x.Test1).Width(200).Hidden(true);
columns.Bound(x => x.TimezoneOffset).Width(200).HtmlAttributes(new { id = "reporting-date-offset" });
columns.Bound(x => x.Test2).Width(200).Hidden(true);
columns.Bound(x => x.ReportingDateAdjusted).Width(500).HtmlAttributes(new { id = "reporting-date-adjusted" })
.Filterable(f => f.UI(GridFilterUIRole.DateTimePicker).Cell(c => c.Template("dateFilter")));
columns.Bound(x => x.Test3).Width(200);
columns.Bound(x => x.Test4).Width(200).Hidden(true);
columns.Bound(x => x.Test5).Width(200);
})
The first time instead of the Id, the template column appears.
The Id column should appear and the template column should remain hidden.