Disable design view on code-behind page

淺唱寂寞╮ 提交于 2019-12-21 06:08:02

问题


I often hit F7 when viewing the .aspx page I am working on to get to the code-beind, but sometimes just out of natural habit I hit F7 again (not sure why, but it happens often enough to be frsutrating). Hitting F7 on the code-behind switches to design view for the .aspx which often times takes a while to render.

I already have 'source view' as the default open, but I would like F7 when in the code-behind to swap back to the .aspx source instead of design... is this possible?


回答1:


http://www.codeproject.com/KB/macros/ToggleAspNetCodeBehind.aspx?print=true with the following modifications should be what you need:

**Change the line:**
    OpenCodeBehindFile(activeDoc)
to:
  OpenCodeBehindFile(activeDoc & ".cs")

**Change the line in OpenCodeBehindFile from:**
  projItem.Open(Constants.vsViewKindCode)
to:
  projItem.Open(Constants.vsViewKindCode).Activate()

Reference: http://social.msdn.microsoft.com/forums/en-US/csharpide/thread/90ccfd68-c083-49a4-947a-03178d6af288/




回答2:


I have this behavior, and I thought it was this way out of the box, but I do have ReSharper installed. Looking at the keyboard settings my F7 is bound to "View.ViewCode (F7 (Settings Designer))" and "View.ToggleDesigner (F7 (Global))".



来源:https://stackoverflow.com/questions/1208979/disable-design-view-on-code-behind-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!