MVC Gators and VS2010

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

</head>

<body>

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

</body>

</html>

 

And then I add a closing gator

<% } %>

 

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

<body>

    <% using (Html.BeginForm())

       { %>

    <% } %>

</body>

 

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…

Advertisements

Leave a Reply

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

WordPress.com Logo

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

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

%d bloggers like this: