MVC Gators and VS2010

I start with an opening statement like this on a View:



    <% using (Html.BeginForm()) { %>




And then I add a closing gator

<% } %>


As soon as I hit enter to the closing gator, VS2010 reformats the code to this:


    <% using (Html.BeginForm())

       { %>

    <% } %>



Note how the opening gator gets moved down a line.

I think this is better b/c it is more in-line with our Server-side best practices – though it is against most Javascript best practices (and the examples in the book).  I assume there is a setting in VS2010 to not automatically put in the line break…

Also, note to self:

If you write your gator like this:

<%= Html.Label(TempData["message"].ToString()); %>


You will get an error message like this:

Remove the semicolon at the end and things work.  The “=” in the Gator means you don’t use a semicolon at the end…

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: