0

I am creating a custom master page in visual studio. I inherited this from another developer who has not learnt how to indent code properly. One thing that I have noticed that seems it is not possible to collapse code when editing a master page. Is there a way that I can auto format the code to that I get the correct indentation?

In the past I have used

(ctrl+k, ctrl+d)

but this does not seem to work...

3
  • I have master pages in two places in my VS solution: some in a Module, and some in a subdirectory of the mapped Layouts directory. Curiously, the master in Layouts supports things like Auto Format, collapsing elements, and the little drop-down boxes at the top of the file for "Server Objects & Events", but the masters in the Module do not. If your Master isn't in the Layouts directory, you could move it there, try Auto Formatting, and move it back...
    – Rawling
    Oct 10, 2011 at 15:52
  • If I open it from layouts it works. Very strange...
    – John
    Oct 10, 2011 at 15:59
  • That is weird. I actually prefer the less-functional version because I find the auto-closing tags annoying :) Maybe someone can answer this question with why one is functional and the other isn't.
    – Rawling
    Oct 10, 2011 at 16:04

2 Answers 2

2

Formatting worked for me for the past when you rightlick the .master (or .ASPX/.ASCX) page in VS.NET and explicitly select "Master Page Editor". It seems its default but somehow still explicitly needed to be selected.

1
  • +1, this works for me as well. Again, default, but only works if you pick it manually.
    – Rawling
    Oct 11, 2011 at 7:56
0

It works fine for me, check for the XHTML Validation errors using VS studio 2010 OR SharePoint Designer 2010 ( green underlines... etc). Correct them and the (ctrl+k, ctrl+d) should work fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.