Reputation: 28101
The F7 key in Visual Studio - it allows the user to switch between the code for a designer element (e.g. a Windows Form or a Web User Control).
This works great in Windows forms: when I'm in the .cs
file for a visual element (e.g. a User Control), it shows me the visual designer.
It doesn't work so great for me in ASP.NET: When I'm in the markup (e.g. the Source view of the Designer), it takes me to the CodeBehind, which is exactly what I want. However, once in the CodeBehind, it takes me back to the Design view on the Designer, which is never what I want.
How do I make Visual Studio always show the Source view instead of the Design view when hitting F7 from a Codebehind page?
Upvotes: 18
Views: 10736
Reputation: 1427
In Visual Studio 2022 use the "Source View" option under "Web Forms Designer"
Upvotes: 0
Reputation: 18937
Tools > Options > Keyboard
Search for View.ToggleDesigner
in "Show Commands Containing".
Add new shortcut to Global
with F7.
Upvotes: 19
Reputation: 817
Simply right-click any .html/.htm file in Solution Explorer and select Open With…
Now select HTML (Web Forms) Editor,click Set as Default and then hit OK.
All files with the same extension will now always open in the Web Forms editor and you get both Design- and Split view.
Upvotes: 0
Reputation: 459
To Set That Open Options From Tools in Visual Studio:
Upvotes: 16
Reputation: 3916
I don't work in ASP.NET but there is a setting under options -> HTML Designer to start pages in Source view, Design view or split view. Might want to try that.
Upvotes: 1