如何在Visual Studio中的ASPX文件中添加区域 [英] How to Add REGION in Visual Studio in aspx Files

查看:265
本文介绍了如何在Visual Studio中的ASPX文件中添加区域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将asp.net与后面的代码和c#一起使用.

I use asp.net with code behind and c#.

所以在VS 2010中,每个.aspx页都有两个文件.

So I have two file for every .aspx page in VS 2010.

在.aspx.cs页中,我可以使用以下代码在代码中添加区域:

In .aspx.cs page I am able to add regions in my code using:

#region Name Region
#endregion

我的问题:

  • 如何在.aspx文件中执行此操作? #region似乎仅在.cs文件中有效.
  • 您是否知道其他有用的标记来帮助我更好地组织.aspx和.cs文件的代码?
  • 您知道在我的代码中用于扩展或折叠我所有区域的键盘快捷键吗?

感谢您的帮助.

推荐答案

您知道键盘快捷键可以在代码中扩展或折叠我的所有区域吗?

Do you know the keyboard shortcuts to expand or collapse all my region in my code?

以下是一些适合您的和弦.

Here are some key chords for you.

Ctrl-M Ctrl-O 将折叠打开的文档(或突出显示的部分)中的所有区域.

Ctrl-M Ctrl-O will collapse all the regions in the opened document (or the highlighted section).

Ctrl-M Ctrl-M 将折叠或打开光标所在的可折叠部分.

Ctrl-M Ctrl-M will collapse or open the collapsible section the cursor is on.

Ctrl-M Ctrl-L 将折叠或打开所有内容.

Ctrl-M Ctrl-L will collapse or open everything.

现在这是我经常使用的代码,尤其是在javascript文件中:高亮显示一些代码,然后按 Ctrl-M Ctrl-H 将其隐藏,这将产生一个折叠后的代码旁边的小扩展器+-.按 Ctrl-M Ctrl-O 再次将其展开.

Now here is one i use frequently, especially in javascript files: highlight some code, then press Ctrl-M Ctrl-H to hide it, which will produce a little expander +- next to the collapsed code. Press Ctrl-M Ctrl-O to expand it again.

另请参见此博客Scott Guthrie的帖子,其中详细介绍了一些您可以下载的海报,其中包含许多VS快捷键组合.

Also see this blog post by Scott Guthrie which details some posters you can download with lots of the VS shortcut key combinations on them.

这篇关于如何在Visual Studio中的ASPX文件中添加区域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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