Quantcast
Channel: Brian Mains Blog
Viewing all articles
Browse latest Browse all 15

) Expected Error in ASP.NET MVC

$
0
0

I've been just getting into MVC lately and run into a weird error, mostly weird because it's mostly due to the error message itself than the actual problem.  The problem is very easy to fix, but first, a little background.  In the various MVC frameworks out there, there are two ways to render controls: using these two syntaxes:

<%= Html.HelperMethod() %>

<% Html.HelperMethod(); %>

Note the syntaxes; the first syntax returns a string.  This string gets rendered directly to the output stream.  The second option uses the current context to render the HTML directly to the browser via the HttpResponse.  It's up to you to determine which of these options the helper method you are currently using, which is helped along using the inline documentation.  But I ran into an interesting situation: if you forget (or don't realize) that the options you are using happen to use the <%= %> syntax and includes a semi-colon, you may get the ) expected error.  Why, I don't know, but that's what I been running into.

Some of the issues may be with the HTML helper themselves; for instance, some of the features you may use may need to use the latter option of rendering rather than the former, which seems to have been what my issue was, but I haven't yet placed my entire finger on it.


Viewing all articles
Browse latest Browse all 15

Trending Articles