Is there anyway to make line continuations work in a razor view.
For example, the following code doesn't work
@Html.Grid(Model.Documents).Columns(column =>
{
column.For(x => x.FleetNumber).Named("Fleet No.");
column.For(x => x.OrderNumber).Named("Order No.");
column.For(x => x.DateCreatedForDisplay).Named("Created").SortColumnName("DateCreated");
})
.Empty("Sorry, no documents were found")
.Attributes(@class => "datagrid")
.Sort(Model.Query.SortOptions())
I have to put the last three lines onto one single line
@Html.Grid(Model.Documents).Columns(column =>
{
column.For(x => x.FleetNumber).Named("Fleet No.");
column.For(x => x.OrderNumber).Named("Order No.");
column.For(x => x.DateCreatedForDisplay).Named("Created").SortColumnName("DateCreated");
}).Empty("Sorry, no documents were found").Attributes(@class => "datagrid").Sort(Model.Query.SortOptions())
You could denote that the whole thing is an expression like so:
@(Html.Grid(Model.Documents).Columns(column =>
{
column.For(x => x.FleetNumber).Named("Fleet No.");
column.For(x => x.OrderNumber).Named("Order No.");
column.For(x => x.DateCreatedForDisplay).Named("Created").SortColumnName("DateCreated");
})
.Empty("Sorry, no documents were found")
.Attributes(@class => "datagrid")
.Sort(Model.Query.SortOptions()))
Note the additional parentheses.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With