Visual Studio 2010 formatting after saving - visual-studio-2010

Visual Studio 2010 is giving me grief. When I make changes to an aspx file and save the formatted code changes from this:
to this... every time.
Here's my formatting.
In Tag Specific Options under HTML the P tag was missing. So I added this but this didn't fix the problem.
Can anyone help?

to format a section: ctrl + k, ctrl + f or ctrl + e, ctrl + f
to format a document ctrl + e, ctrl + d

Related

Ctrl + K + D - The style sheet contains syntax errors and cannot be formatted

In Visual Studio, when pressing Ctrl + K + D to format code, I'm getting this error
As per the suggestion, I've tried to solve the issue:
In Visual Studio, open the Tools menu and select Options
Expand the Text Editor group, then the CSS group.
Click on Miscellaneous and you'll see the option to enable Detect Errors there.
The code I need to format is:
.ie .actual-form table {
width: 100%
}
What am I missing here?

how to enable the comment buttons in visual studio

I am using visual studio.
In the tool bar,"comment" and "uncomment" buttons are disabled.
and If I use Ctrl + K and Ctrl + C` also ,I am not able to comment the code.
how to solve this?
It's CTRL + K + C not CTRL + K and CTRL + C :)
You need to select some text with your mouse to use those buttons. You also can't be in a state where editing is locked (such as while debugging).

How to uncomment multiple lines of code in Visual Studio

I did a ctrl K + ctrl C (adds // to a line) on a lot of lines of code that I need uncommented. What is the quick key method to uncomment code in Visual studio?
Ctrl+K, Ctrl+U removes the // comments
I believe it is Ctrl + K, Ctrl + U.
Ctrl + K, Ctrl + U.
There is also a button for it on the Standard toolbar.
ctrl + /
can be used for adding and removing comments.
Try + U or click the little icon on the toolbar.
If you're using Resharper, there is a much nicer alternative:
just right Alt + / for both
By using this single shortcut, you can simply toggle between commenting/uncommenting code, without having to remember/switch between two shortcuts for each.
Ctrl + K + C (to comment) and Ctrl + k + U (to uncomment the code)
Or
or use Ctrl + / (for the same)
Qwerty: Ctrl + /
Azerty: Ctrl + :
Just wanted to add, that in the latest version of VS, ctrl + u makes it caps. They instead made it a toggle command, so it is actually just ctrl + k again to make it uncommented.
I have the german keyboardlayout.
VSCode-x64-1.52.1
To leave a comment:
You have to highlight the code, then push
Ctrl + #
or
Ctrl+K, stay at Ctrl and push C
to commen out:
Ctrl + #, it toggles on/off the comment
or
Ctrl + K, stay at Ctrl and push U
Mine was a bit different. It is ctrl-shift-C to comment and ctrl-shift-alt-C to uncomment.
I am using Visual Studio Community 2017.
Ctrl + Q alternates between comment and uncomment.
Unfortunately Ctrl K Ctrl U does not work in few environments, rather it adds instead of removing. My case on windows, using composer file I faced Ctrl K Ctrl U not working.
I m using VS Code, ver 1.36.1
links to all keys short cuts: https://code.visualstudio.com/docs/getstarted/keybindings
In Visual C++ 2019 Ctrl + Shift + / both comments and uncomments.

What is the keyboard shortcut to collapse current region in VS2008?

By "current region" I mean a region where the cursor is.
EDIT: I am looking for region toggling, not outlining expansion toggling. By "region" I mean section of code defined by #region and #endregion directives. Ctrl + M, Ctrl + M toggles closest outlining (which for most cases would be current method not region).
CTRL + M, M should do the trick
By the way you can download a "poster" of shortcuts here
It can differ from mapping to mapping but the default is :
Ctrl + M , Ctrl + M
In Visual Studio 2010 use CTRL + M , CTRL + S. I did not check Visual Studio 2008

Format Javascript in Visual Studio 2008?

Is there a way or a VS add-on to format Javascript in the text editor? Like properly indent each line, align the braces, ... etc?
It's simple just use Ctrl + K + D for Javascript formatting and use Ctrl + A + K + F for formatting your c#, vb code
Enjoy coding with shortcut's :-)
Inside VS , you have Edit-Advanced-Format Document, also goto options select editors and then Javascript/HTML and select/deselect desired options

Resources