tags:

views:

41

answers:

2
<% =reg.Event.Title + " - " + reg.Event.Date %>

Works.

<% =reg.Event.Title + " - " + reg.Event.Date; %>

Tosses a runtime error:

Compiler Error Message: CS1026: ) expected

There are no mismatched operators - no unclosed '(' ...could something in a controller or further upstream in the backend be to blame?

thx

+2  A: 

When using <%= %> leave off the semi colon. If you used <% Response.Write(...) %> you could include the semi-colon. <%= %> is a shorthand notation for writing strings to the client.

Asaph
+3  A: 

Probably ´<%= ... %>´ is turned into a Response.Write() statement during compilation, e.g:

Response.Write(reg.Event.Title + " - " + reg.Event.Date;);

...then the semicolon is definitely incorrect.

M4N
That's exactly the case. <%=X%>is merely a convenient short handhand for Response.Write(X). Therefore whatever X is, it must be syntactically suitable.
mjv