Ctrl+K, Ctrl+D More than just formatting now.

Posted Wednesday, November 2, 2005 10:23 AM by C-Dog's .NET Tip of the Day
Do you have code that the ASP.NET 1.1 designer screwed up like the snippet below?
<TABLE cellSpacing="0" cellPadding="0" width="495" border="0">
<TR>
<TD class="SubHeader">&nbsp;
<frameworkcontrols:label id="BookItLabel" Key="BookItTitle" ResourceName="ReservationLabels" ResourcePath="/Configuration"
CssClass="BoldLabel" Runat="server"></frameworkcontrols:label></TD>
<TD class="SubHeader" style="font-size: .9em; text-align: right;">
<asp:LinkButton id="ChangeBookItButton" Runat="server" BorderStyle="None" Font-Underline="True"></asp:LinkButton></TD>
<TD class="SubHeader" width="40"></TD>
</TR>
</TABLE>
Now this can be easily corrected in Visual Studio 2005 by using the Format Document menu option (shortcut Ctrl+K, Ctrl+D). It will autoamtically clean up your code and lowercase any html elements that might be capitalized like below.
 <table cellspacing="0" cellpadding="0" width="495" border="0">
<tr>
<td class="SubHeader">
&nbsp;
<FrameworkControls:Label ID="BookItLabel" Key="BookItTitle" ResourceName="ReservationLabels"
ResourcePath="/Configuration" CssClass="BoldLabel" runat="server">
</FrameworkControls:Label>
</td>
<td class="SubHeader" style="font-size: .9em; text-align: right;">
<asp:LinkButton ID="ChangeBookItButton" runat="server" BorderStyle="None" Font-Underline="True"></asp:LinkButton></td>
<td class="SubHeader" width="40">
</td>
</tr>
</table>

Read the complete post at http://www.dotnettipoftheday.com/blog.aspx?id=32