开发者

Regions in webforms asp.net

I am new to asp.net, I want to define #Region in my .cs page file. I开发者_如何学JAVAs it possible to that in web pages. I know it can be done in winforms.


You can define #region tags in your code behind files the same way you can in any .cs file - it makes no difference if they are in a web project or any other project.

You can't define them in the .aspx page.

In your .cs code behind file:

#region "Name of region"

   // Code comes here

#endregion


No, you can't define #regions in webforms (in the ASPX file), but you can collapse tags very easily in visual studio, as long as your markup is properly defined.


  #region Description of the code within this region
  protected void Page_Load(object sender, EventArgs e)
  {

  }
  #endregion

I'm using Visual Studio 2008 SP1 and it's working. Which version are you using?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜