问题
I have a problem with rendering a mvc telerik template grid control. Every thing seems fine but I have this error:
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS1002: ; expected
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS1002: ; expected
Source Error:
Line 14:
Line 15:
Line 16:
}).Width(100); Line 17: columns.Bound(p => p.ProductName).Title("Product"); Line 18: columns.Bound(p => p.WholesalePrice).Title("Price");
here is my source code:
@(
Html.Telerik().Grid(Model)
.Name("grid")
.DataKeys(key => key.Add(p => p.ID))
.Columns(columns =>
{
columns.Template(p =>
{
@<div>
<img alt="@p.ProductName"src="@p.ImageURL" />
</div>
}).Width(100);
columns.Bound(p => p.ProductName).Title("Product");
columns.Bound(p => p.WholesalePrice).Title("Price");
})
.Pageable()
.Groupable()
.Sortable()
)
without defining the column template everything seems to work fine.
回答1:
Try:
@(
Html.Telerik().Grid(Model).Name("grid")
.Columns( columns =>
{
columns.Template(
@<text> bla bla </text>
);
columns.Bound(p => p.ProductName).Title("Product");
}).Pageable().Sortable()
)
来源:https://stackoverflow.com/questions/10631959/problems-with-rendering-a-templated-asp-net-mvc-telerik-grid