Problems with rendering a templated asp.net mvc telerik grid

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-12 02:36:38

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!