MVC Gators and VS2010
July 6, 2010 Leave a comment
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…