Search code examples
visual-studio-2017

Is there a built-in method in VS2017 to clean up the tabbing in my code?


When I am working on designing my pages in ASP, copy & paste, adding code, and moving code can get the tab alignments messed up. I was wondering if VS2017 had a built-in way to clean up the tabs and align everything to its respective proper levels.

Before:

                        <asp:DropDownList ID="DropDownList17" runat="server" Width="120px"></asp:DropDownList>
                    </td>

        <td>

         <asp:DropDownList ID="DropDownList20" runat="server" Width="120px"></asp:DropDownList>
                  </td>
        <td>
            
                        <asp:DropDownList ID="DropDownList21" runat="server" Width="120px"></asp:DropDownList>
        </td>
                   <td>
            
             <asp:DropDownList ID="DropDownList22" runat="server" Width="120px"></asp:DropDownList>
        </td>
</tr>
    <tr>

After:

            <asp:DropDownList ID="DropDownList17" runat="server" Width="120px"></asp:DropDownList>

        </td>
        <td>
            <asp:DropDownList ID="DropDownList20" runat="server" Width="120px"></asp:DropDownList>

        </td>
        <td>
            <asp:DropDownList ID="DropDownList21" runat="server" Width="120px"></asp:DropDownList>

        </td>
        <td>
            <asp:DropDownList ID="DropDownList22" runat="server" Width="120px"></asp:DropDownList>

        </td>
        </tr>

Solution

  • Either go to:

    Edit > Advanced > Format Document

    Or the default shortcut is Ctrl + E,D