<%= Html.Telerik().Grid(Model)
                .Name("TDW")
        .Columns(colums =>
        {
            colums.Bound(item => item.dwmc).Title("单位名称");
            colums.Bound(item => item.dwdz).Title("单位地址");
            colums.Bound(item => item.email);
            colums.Template(item=> 
           { 
                %>
                <%= Html.ActionLink("Edit", "Editing", new { id = item.dwid  },new { @class="t-link action-edit" }) %>
                <%= Html.ActionLink("Delete", "Delete", new { id = item.dwid },new { @class = "t-link action-delete" }) %>
                <%
           }).Title("Actions").Width(150);            
        })
        .Pageable()
        .Sortable();
%>上面的 代码运行时总是提示
编译器错误消息: CS1525: 无效的表达式项“)”源错误:
行 107:            colums.Bound(item => item.email);
行 108:            colums.Template(item=> 
行 109:           { 
行 110:                %>
行 111:                <%= Html.ActionLink("Edit", "Editing", new { id = item.dwid  },

解决方案 »

  1.   

     colums.Template(item=>  
      {  
    这里是不是有错?
    没条件 和反括号?
      

  2.   

    就是提示那里的错误,,我有反括号,,
    是不是<%   %>中间不认为是表达式的条件啊,,我去试试
      

  3.   

    <%= Html.Telerik().Grid(Model)
      .Name("TDW")
      .Columns(colums =>
      {
      colums.Bound(item => item.dwmc).Title("单位名称");
      colums.Bound(item => item.dwdz).Title("单位地址");
      colums.Bound(item => item.email);
      colums.Template(item=>  
      {  
      <%= Html.ActionLink("Edit", "Editing", new { id = item.dwid },new { @class="t-link action-edit" }) %>
      <%= Html.ActionLink("Delete", "Delete", new { id = item.dwid },new { @class = "t-link action-delete" })%>
      }).Title("Actions").Width(150);   
      })
      .Pageable()
      .Sortable();
    %>
      

  4.   

      %>
      <%= Html.ActionLink("Edit", "Editing", new { id = item.dwid },new { @class="t-link action-edit" }) %>
      <%= Html.ActionLink("Delete", "Delete", new { id = item.dwid },new { @class = "t-link action-delete" }) %>
      <%少了这两个%>  <% IDE环境里就提示错误了
      

  5.   

    <%  %>好像不可以嵌套
      

  6.   

    Telerik Extensions for ASP.NET MVC 搞死我了,,以后我再也不用这些控件了请大家看,
    在他的帮助中这样写的,,用的是columns.Bound, columns.Template
    Grid column definition
    <% Html.Telerik().Grid(Model)
           .Name("Orders")
           .Columns(columns =>
           {
              //Column which will display the OrderID property of the Order
              columns.Bound(o => o.OrderID);          //Column which will display the OrderDate property. The header will display "Order"
              columns.Bound(o => o.OrderDate).Title("Order");          //Template column which shows an action link
              columns.Template(o => 
              {
                  %>
                      <%= Html.ActionLink("Edit", "Home", new { id = o.OrderID }) %>
                  <%
              }).Title("Edit");
           })
           .Render();
    %>
    ******************8
    在网站的示例中是这样的用的是columns.Bound,columns.Command
     .Columns(columns =>
            {
                columns.Bound(c => c.ContactName);
                columns.Bound(c => c.Country).Width(170);
                columns.Bound(c => c.Address).Width(200);
                columns.Bound(c => c.BirthDay).Width(130).Format("{0:d}");
                columns.Command(commands =>
                {
                    commands.Edit();
                    commands.Delete();
                }).Width(180).Title("Commands");
            })
    *************************
    在下载的源代码中用的是columns.Add,,注意在IDE的智能感知中没有add  .Columns(columns =>
            {
               columns.Add(c => c.CustomerID).Width(130);
               columns.Add(c => c.ContactName);
               columns.Add(c => c.Country).Width(120);
               columns.Add(c => c.Address).Width(200);
               columns.Add(c => 
               { 
                    %>
                    <%= Html.ActionLink("Edit", "Editing", new { id = c.CustomerID },
                            new { @class="t-link action-edit" }) %>
                    <%= Html.ActionLink("Delete", "Delete", new { id = c.CustomerID },
                            new { @class = "t-link action-delete" }) %>
                    <%
               }).Title("Actions").Width(150);
            })
    结果是上面的代码 成功!!!*********************************
    MG,,!!!一个好的帮助太重要了