与渲染模板asp.net的MVC Telerik的电网问题 [英] Problems with rendering a templated asp.net mvc telerik grid

查看:115
本文介绍了与渲染模板asp.net的MVC Telerik的电网问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个渲染Telerik的MVC模板网格控件的一个问题。每一件事似乎不错,但我有这个错误:

I have a problem with rendering a mvc telerik template grid control. Every thing seems fine but I have this error:

编译错误

说明:该请求提供服务所需资源的编译过程中出现错误。请检查下列特定错误详细信息并适当地修改源$ C ​​$ C。

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.

编译器错误信息:CS1002:;预计

Compiler Error Message: CS1002: ; expected

说明:该请求提供服务所需资源的编译过程中出现错误。请检查下列特定错误详细信息并适当地修改源$ C ​​$ C。

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.

编译器错误信息:CS1002:;预计

Compiler Error Message: CS1002: ; expected

源错误:

14号线:结果
   第15行:结果
   第16行:结果
  })宽度(100)。第17行:columns.Bound(P
  => p.ProductName).title伪(产品);第18行:columns.Bound(P => p.WholesalePrice).title伪(价格);

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");

这是我的源$ C ​​$ C:

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.

推荐答案

尝试:

@(
    Html.Telerik().Grid(Model).Name("grid")
        .Columns( columns =>
                      {
                          columns.Template(
                              @<text> bla bla </text>
                          );
                          columns.Bound(p => p.ProductName).Title("Product");
                      }).Pageable().Sortable()
)

这篇关于与渲染模板asp.net的MVC Telerik的电网问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆