修复在Visual Studio中aspx文件的格式? [英] Fix formatting of aspx file in Visual Studio?

查看:190
本文介绍了修复在Visual Studio中aspx文件的格式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



 < asp:TableCell ID = TableCell9runat =server>公司
组织:< / asp:TableCell>< asp:TableCell ID =TableCell10runat =server>

如何让格式化程序将其更改为如下所示:

 < asp:TableCell ID =TableCell9runat =server>公司组织:< / asp:TableCell> 
< asp:TableCell ID =TableCell10runat =server>






strong>



我打开Tools-> Options,然后浏览到文本编辑器。我有一个语言列表。我选择了HTML,因为这是控制aspx文件格式的语言。



我更改了标签包装,没有超过指定长度时包装标签。



然后按下ctrl + k,ctrl + d(格式化文档)。这并没有解决问题。






我不想做的事情



手动编辑文件以修复所有标签。

有什么想法?

解决方案

我遇到了同样的问题,我在Scott Gu的博客上找到了答案。

解决方案是在Visual Studio中设置格式化规则(右键单击任何标签,单击格式和验证,单击标签特定选项)

按ctrl- k,ctrl-d文档将按照您的设置进行格式化。如果结束标签不移动到新行,这是因为结束标签和之前的标签之间没有空格。发生这种情况是因为Visual Studio正在小心不改变页面的呈现方式。



完整的博客文章检出Scott Gu的博客帖子。



http://weblogs.asp.net/scottgu/archive/2006/07/07/Tip_2F00_Trick_3A00_-Custom-formatting-HTML-in-Visual-Web-Developer-and-Visual- Studio-2005.aspx


I have a file with a lot of this kind of thing in it:

    <asp:TableCell ID="TableCell9" runat="server">Company 
Organization:</asp:TableCell><asp:TableCell ID="TableCell10" runat="server">

How can I get the formatter to change it to shows like this:

<asp:TableCell ID="TableCell9" runat="server">Company Organization:</asp:TableCell>
<asp:TableCell ID="TableCell10" runat="server">


What I have tried:

I opened Tools->Options then browsed to Text Editor. I got a list of Languages. I selected HTML because that is the language that controls formatting for aspx files.

I changed "tag wrapping" to not have "Wrap tags when exceeding specified length" checked.

I then pressed ctrl+k, ctrl+d (Format the document). This did not fix the problem.


What I don't want to have to do:

Edit the file manually to fix all the tags.

Any ideas?

解决方案

I was having the same problem, and I found the answer on Scott Gu's blog.

The solution is to setup the formatting rules in Visual Studio (right click on any tag, click on Formatting and Validation, click on Tag Specific Options)

When press ctrl-k, ctrl-d the document will format as per your settings. If a closing tag does not move to a new line, it's because there is no space between the end tag and what is preceding it. This happens because Visual Studio is being careful to not change how the page is rendered.

For the full blog post checkout Scott Gu's blog post.

http://weblogs.asp.net/scottgu/archive/2006/07/07/Tip_2F00_Trick_3A00_-Custom-formatting-HTML-in-Visual-Web-Developer-and-Visual-Studio-2005.aspx

这篇关于修复在Visual Studio中aspx文件的格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆