This is a migrated thread and some comments may be shown as answers.

[Solved] Error when grid uses Render()

2 Answers 111 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Richard
Top achievements
Rank 1
Richard asked on 22 Mar 2011, 03:04 PM
I have the below grid markup:

<%

 

: Html.Telerik().Grid(Model)

 

 

.Name(

 

"Category")

 

 

.Columns(columns =>

 

{

 

columns.Template(e =>

 

{

 

%>

 

<%

 

= Html.ActionLink("Edit", "Edit", new { id = e.Id })%>

 

 

<%

 

}).Title(

 

"Edit");

 

 

columns.Bound(e => e.Name);

 

columns.Bound(e => e.Email);

 

columns.Bound(e => e.IsActive);

 

})

 

.Render();

 

%>


I receive this error:
Compiler Error Message: CS1525: Invalid expression term ')'

Source Error:

Line 12:                 {
Line 13:                     columns.Template(e =>
Line 14: {Line 15:                             %>
Line 16:                             <%= Html.ActionLink("Edit", "Edit", new { id = e.Id })%>

If I remove the Template column but leave the .Render(), I still receive a similar error.  If I remove both the template column and the .Render(), it works fime.

What should I do?

2 Answers, 1 is accepted

Sort by
0
Bodevain Svensson
Top achievements
Rank 1
answered on 25 Mar 2011, 03:43 PM

Your grid signature looks correct when I compare it against this example except for the colon in the very beginning:
 

<% : Html.Telerik().Grid(Model)

What do you need it for? Can this mess-up the parsing of the view at runtime?

0
Richard
Top achievements
Rank 1
answered on 25 Mar 2011, 09:15 PM
Yes, I think that you are right.  When the Render() method is used, it renders the content so the colon is not needed and probably the reason for my problems.

Thanks for the help.
Tags
Grid
Asked by
Richard
Top achievements
Rank 1
Answers by
Bodevain Svensson
Top achievements
Rank 1
Richard
Top achievements
Rank 1
Share this question
or