简体   繁体   English

Visual Studio自动格式在aspx页面上不起作用

[英]Visual Studio Auto Formatting not working on the aspx page

I am running Visual Studio 2008. I cannot get the auto format to work on the source code of my aspx page. 我正在运行Visual Studio2008。我无法使自动格式在aspx页面的源代码上工作。 I have tried it from the edit menu and the ctrl K, D. Nothing works. 我已经从编辑菜单和ctrl K,D进行了尝试。 If I manually fix everything, the next time I open the file the formatting is gone. 如果我手动修复所有问题,则下次打开文件时,格式将消失。 Here is a sample of what it looks like: 以下是其外观示例:

<cc1:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="2" CssClass="ajax__myTab" Width="100%" ScrollBars="Horizontal">
    <cc1:TabPanel ID="TabPanel1" runat="server" HeaderText="Work - Main" Enabled="true">
        <headertemplate>
            Main
        </headertemplate>
        <contenttemplate>
            <table cellpadding="3" cellspacing="1">
                <tr>
                    <td style="text-align: right">
                        Escalated Inquiry ID:
                    </td>
                    <td>
                        <asp:Label ID="lblPkey" runat="server"></asp:Label>
                    </td>

take a look at this post . 看一下这个帖子 Also, make sure you don't have any missing closing tags. 另外,请确保您没有丢失任何结束标签。

I have seen this when there is a problem with the HTML. HTML出现问题时,我已经看到了这一点。 If there is an error in syntax (missing a closing tag, for instance), then the parser doesn't know where the tabs should go. 如果语法有错误(例如,缺少结束标记),则解析器将不知道选项卡应该放在哪里。

EDIT 编辑

Based on your sample (assuming you pasted everything) 根据您的样本(假设您粘贴了所有内容)

<cc1:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="2" CssClass="ajax__myTab" Width="100%" ScrollBars="Horizontal">
    <cc1:TabPanel ID="TabPanel1" runat="server" HeaderText="Work - Main" Enabled="true">
        <headertemplate>
            Main
        </headertemplate>
        <contenttemplate>
            <table cellpadding="3" cellspacing="1">
                <tr>
                    <td style="text-align: right">
                        Escalated Inquiry ID:
                    </td>
                    <td>
                        <asp:Label ID="lblPkey" runat="server"></asp:Label>
                    </td>

, here is what is missing: ,这是缺少的内容:

                </tr>
            </table>
        </contenttemplate>
    </cc1:TabPanel>
</cc1:TabContainer>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM