2011-02-15 92 views
5

無論如何,使剃鬚刀視圖中的線延續工作。剃鬚刀線延續

例如,下面的代碼無法正常工作

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

回答

6

你可以表示,整個事情是一個表達式像這樣:

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

請注意額外的括號。