Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 898591
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T15:04:11+00:00 2026-05-15T15:04:11+00:00

In Visual Studio 2010, under Tools -> Options -> Text Editor -> HTML ->

  • 0

In Visual Studio 2010, under Tools -> Options -> Text Editor -> HTML -> Formatting -> Tag Specific Options, there are options for configuring how the editor auto formats different HTML and ASP.NET tags. This includes things like if it should automatically put a newline before and after the tag, etc.

Is there a place to configure the formatting rules for <% %> <%= %> and <%: %> blocks in a similar fashion?

In particular, I would like to not force a newline before <%= and <%: blocks.

For example, I have already configured the options for the h1 tag to not add newlines around its contents and that works great with static content, but it doesn’t work when there is a <%: or <%= block in the h1 tag. I currently get this:

<h1>
    <%: Model.Name %></h1>

but I would like this:

<h1><%: Model.Name %></h1>

In a perfect world, I would also like to auto format the contents of <% %> blocks to make sure there is always a space between the <% and its contents.

For example, good:

<% if (something) { %>

bad:

<%if (something) {%>

So, are there any settings buried somewhere to control either of these formatting behaviors?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T15:04:12+00:00Added an answer on May 15, 2026 at 3:04 pm

    Thanks to @schellack for the knudging me in the right direction. Here are the settings I needed to get the behavior I wanted (all within the tag specific options dialog box):

    • Default Settings -> Client tag supports contents
      • Line breaks: Before and after
      • (This makes h1, p, and similar tags behave the way I wanted. Others may want None as a choice. Personal preference I suppose.)
    • Add a new tag under Client HTML Tags.
      • Tag Name: %
      • Closing tag: No closing tag
      • Line breaks: Before and after
      • (This catches actual code blocks and keeps them separated from HTML markup with line breaks before and after the code blocks.)
    • Add another new tag under Client HTML Tags
      • Tag Name: %:
      • Closing tag: No closing tag
      • Line breaks: None
      • (This catches <%: %> blocks and keeps them inline with HTML markup without any line breaks.)
    • Add another new tag under Client HTML Tags
      • Tag Name: %=
      • Closing tag: No closing tag
      • Line breaks: None
      • (Similar to the previous one. This catches <%= %> blocks and keeps them inline with HTML markup without any line breaks.)

    The trick is that the editor seems to recognize <% %> blocks as a client tag named ‘%’ that has no closing tag. Same deal for <%: %> and <%= %>.

    With these settings (combined with the rest of the defaults in Visual Studio) I get formatted markup that looks like the following (which is the compact form I was looking for):

        <h1><%: Model.Name %></h1>
        <ul>
            <% foreach (var item in Model.Items) { %>
            <li><%: item %></li>
            <% } %>
        </ul>
    

    As yet, it doesn’t appear that the second part of my question is possible.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 509k
  • Answers 509k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Here I have provided a 2 solutions: 1)js function 'TextLimit':which… May 16, 2026 at 4:37 pm
  • Editorial Team
    Editorial Team added an answer $("#container").empty(); http://api.jquery.com/empty/ empty has an advantage over setting the element's… May 16, 2026 at 4:37 pm
  • Editorial Team
    Editorial Team added an answer I just spoofed the source to fix it like so:… May 16, 2026 at 4:37 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

Visual Studio 2010 no longer has the VC++ Directories page under Tools / Options.
In Visual Studio 2010 we have under 'tools|options|projects and solutions|build and run' (couldn't find
C# Visual Studio 2010 I am loading a complex html page into a webbrowser
I have installed Visual Studio 2010 and Silverlight 4 tools. Still, i am getting
I am using Visual Studio 2010 with Visual Studio Tools for Office installed. I
I have been trying out the CTP Beta 1 of Visual Studio 2010 and
I am using C# and Visual Studio 2010. When I use OutputDebugString to write debug information,
To preface this I am an Emacs refugee on Visual Studio 2010's shores and
I have an application that I'm developing in Visual Studio 2010 that utilizes a
In Visual Studio 2010, I have a Database Project. I can use this without

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.