HI
I have define a model with a [ScaffoldColumn(false)] column :
[ScaffoldColumn(false)]
public string Column1 { get; set; }
but when I want to show this column in grid but that column not shown :
columns.Bound(column => column.Column1).Width(100);
After remove the [ScaffoldColumn(false)] from that column,
the column shown correctly.
[ScaffoldColumn(false)] column ignored by Grid internally even if Bound explicitly ?
How could I show the [ScaffoldColumn(false)] column using Bound column ?
Best regards
Chris
4 Answers, 1 is accepted
You are correct all the "[ScaffoldColumn(false)] " columns are ignored internally, and there is no way to display such a column in the Grid.
What I would suggest is removing the "[ScaffoldColumn(false)] " annotation, and hiding the desired column(if needed) with the ".Hidden()" configuration. For example:
columns.Bound(m => m.Id).Hidden()
Regards,
Preslav
Progress Telerik
columns.Bound(m => m.Id).Visible(true).Hidden();
If developer set Bound() explicitly, I think the Grid control "SHOULD NOT" not display that column,
I think this is a BUG.
Best regards
Chris
>...and hiding the desired column(if needed) with the ".Hidden()" ...
Yes, but this is not my requirement.
My requirement: I want to show the column even if the column marks as [ScaffoldColumn(false)],
and I want that column pass back (via hidden field - <input type='hidden' name='XXX[0].XXX' ...>) to controller while Form POST.
*I think the Grid control ignore [ScaffoldColumn(false)] columns for AutoGenerateColumn is right, but wrong for Bound() explicitly.
Best regards
Chris
I understand your point, and I believe it sounds reasonable. However, I consulted with my colleagues, and for the time being, we are not planning to change this default behavior.
If you need to use the same model for two different grids - one autogenerated, and the other manually bound, you could extend the main model, and change the data annotations in the new one.
Regards,
Preslav
Progress Telerik