简体   繁体   English

CS1525:无效的表达式术语“)”

[英]CS1525: Invalid expression term ')'

I'm working with Telerik Grid and I want to have a column using the Template to acces to other accion.我正在使用Telerik Grid ,我希望有一个使用Template访问其他操作的列。 The code I have in the Grid is:我在Grid中的代码是:

columnas.Template(o => 
{
    %>
       <%=Html.ActionLink("Texto","Prueba","Peticion", new { id= o.PeticionID }) %>
    <%
}).Title("Prueba");  

When I run the application I get the error:当我运行应用程序时出现错误:

CS1525: Invalid expression term ')' CS1525:无效的表达式术语“)”

And it show the { character after o =>它在o =>之后显示{字符

Any idea about what I'm missing?知道我缺少什么吗?

From the point of view of the C# code (not including server tags), the lambda expression in columnas.Template is empty... which will result in an error.从C#代码(不包括server标签)来看,columnas.Template中的lambda表达式为空...会报错。

effectively what you've written is this:实际上你写的是这样的:

columnas.Template(o => { }).Title("Prueba");

I had the same problem and managed to track down the answer.我遇到了同样的问题并设法找到了答案。

From http://www.telerik.com/community/forums/aspnet-mvc/grid/invalid-expression-term-in-template-statement.aspx来自http://www.telerik.com/community/forums/aspnet-mvc/grid/invalid-expression-term-in-template-statement.aspx

Basically, if you are using column Templates then your grid code should be:基本上,如果您使用的是列模板,那么您的网格代码应该是:

<% Html.Telerik.Grid()
-
-
.Render();%>

instead of:代替:

<%= Html.Telerik.Grid()
-
-
%>

It's hidden fairly well in here:它在这里隐藏得相当好:

http://www.telerik.com/help/aspnet-mvc/telerik-ui-components-grid-columns.html http://www.telerik.com/help/aspnet-mvc/telerik-ui-components-grid-columns.html

There is a really good chance you have an extra ) somewhere at the end of the Grid method.您很有可能在Grid方法末尾的某处有一个额外的 ) 。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM