gpt4 book ai didi

Razor 线延续

转载 作者:行者123 更新时间:2023-12-04 18:51:55 26 4
gpt4 key购买 nike

无论如何,是否可以在 Razor View 中使行延续工作。

例如,下面的代码不起作用

@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())

我必须把最后三行放在一行上
@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())

最佳答案

您可以表示整个事情是这样的表达式:

@(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()))

请注意附加括号。

关于 Razor 线延续,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4998999/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com