working in Visual Studio .NET and ASP.NET, the IDE

G

Guest

does anyone know of a way to highlight a page of code (HTML) and have it
"auto-formatted/structured" for better readablity? Instead of going back and
tabbing all the indents myself, etc. (being lazy) When you have a lot of page
code it would be nice to have this capaiblity, as sometimes my formatting
gets sloppy at times.

i.e.
<!-- start of table -->
<table>
<tr>
<td>
<asp:dropdownlist ..... >
</td>
</tr>
</table>

to this:
<!-- start of table -->
<table>
<tr>
<td>
<asp:dropdownlist ..... >
</td>
</tr>
</table>

thanx.
 
K

Ken Cox [Microsoft MVP]

Hi Chris,

How about Edit > Advanced > Format Document?

In some keyboard schemes, Cntrl + K, Cntrl + D does it too.

There's also Tabify under Advanced.

Ken
 
G

Guest

I don't see a "Format Document" option in the Advanced area? I'm using VS 2003.
I've tried "Tabify" and it didn't do anything after highlighting the code
and selecting it. Also this option isn't smart enough to structure the code,
that I can see?
I'm really surprised that there isn't an auto-format with the VS IDE.

Any other suggestions?
 
K

Ken Cox [Microsoft MVP]

Hey Chris,

Try this:
1. Go Tools > Customize > Commands.
2. Select the Edit category in the left hand pane.
3. Scroll through the right-hand pane to find Document Format.
4. Drag the Document Format Item and drop it on a toolbar.

Does this work?

Ken
 
K

Ken Cox [Microsoft MVP]

Also go to Tools > Options > Keyboard and look for Edit. FormatDocument and
Edit.FormatSelection. Assign them to keys you want to use.

Ken
 
G

Guest

no, I tried and though it is on the toolbar it is "greyed out" (enable set to
false)???

I'm on the design("HTML") view of my code, there is no "Design" tab. That
has something to do with my use of src in the Page Inherits tag on the pages.
Apparently VS doesn't support "src=" but most coding examples in leading
books (i.e. unleashed) uses it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,143
Latest member
SterlingLa
Top