I am creating a collection of WebGridColumns, adding them to my model and passing that to my razor page. I am doing this because there are a variable number of columns that are determined on the fly.
This works well, but now I need to format datetime values to short date and am not sure how this can be accomplished when creating the collection of webgridcolumns.
foreach (var datetimeitem in cols)
{
columns.Add(new WebGridColumn
{
ColumnName = datetimeitem,
Header = "MyHeader",
Format = **format item here**;
});
}
Any ideas?
J
Does your setup look something like this?
If so, you can try