CS1525: Invalid expression term ')'
Asked Answered
H

3

6

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?

Hyacinthus answered 7/2, 2011 at 14:45 Comment(1)
My bad advice got an upvote! There is no problem spliting lambdas across server tags.Coppice
L
4

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");
Lau answered 1/4, 2011 at 15:29 Comment(0)
S
1

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

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

Spiculate answered 29/2, 2012 at 17:2 Comment(0)
F
0

There is a really good chance you have an extra ) somewhere at the end of the Grid method.

Featherstitch answered 7/2, 2011 at 19:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.