Question

In Visual Studio 2005, is there a way to indent correctly the tags in the aspx file (not in .cs files but really in ASPX files which contain HTML/ASP code)?

Was it helpful?

Solution

You can fix indenting using the shortcut Ctrl-K+D

OTHER TIPS

Those keystrokes translate to:

  • Ctrl-K, Ctrl-D : Edit/Advanced/Format Document
  • Ctrl-A, Ctrl-K, Ctrl-F : Edit/Select All, Edit/Advanced/Format Selection

For some reason, the latter seems to work better for me.

Note, these also work for other file types: C#, VB, XML etc...

Ctrl-A (select all), Ctrl-K-F has worked for me.

XML Editor toolbar -> Format whole document.

You want to go to Tools > Options and then navigate to Text Editor > All Languages > Tabs.

The settings you want are: Under Indenting click the "Smart" Radio box for smart indenting. Under Tab you want tab size 4 and indent size 4. And check the radio button labeled Insert Spaces.

You can also change these settings for each language individually. Also some of them don't have Smart indenting, like html.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top