CS1525: Invalid expression term ')'

user564321 picture user564321 · Feb 7, 2011 · Viewed 41.8k times · Source

I'm working with Telerik Grid and I want to have a column using the Template to acces to other accion. The code I have in the Grid is :

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 ')'

And it show the { character after o =>

Any idea about what I'm missing?

Answer

MattDavey picture MattDavey · Apr 1, 2011

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.

effectively what you've written is this:

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