Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prettifying ASP.NET Markup

So, my personal site is running on a custom blog engine that I wrote, and I'm really happy with it. However, it uses a master page, which means that ASP.NET prepends (for no good reason) 'ct100' to all of the id's...For example:

<div id='menu'>
   <ul>
    <li id="ctl00_homeTab" class="active"><a href="/">Home</a></li>
    <li id="ctl00_codeTab"><a href="/code/">Code / Projects</a></li>
    <li id="ctl00_aboutTab"><a href="/about/">About Me</a></li>
    <li id="ctl00_contactTab"><a href="/contact/">Contact</a></li>
  </ul>
</div>

I'd like to prettify the markup a bit, and strip these out, or at least rename them to something that makes more sense. Since Webforms is fairly pluggible, I'd imagine there is a way to do this. I know that the content placeholder is acting as a naming container, but in my case I'd just like to have a decent id, 'master' instead of 'ct100' would be a start.

While I'm being silly and anal, the other thing I'd like to do is fix the indentation of markup when using UserControls. If you take a look at my site you'll see that the user controls have no indentation and break the flow of the source. This probably can't be fixed without running the page output through a pretty printer...and that would be a waste of time.

Do not tell me to switch to MVC. I have already evaluated it, and will be sticking with Webforms.

like image 626
FlySwat Avatar asked Dec 05 '25 06:12

FlySwat


1 Answers

To be completely honest, I don't see the benefit of going through a lot of work for a minimal amount of markup beautification... although I admire your desire in some weird way.

Your site looks fine - put the effort into what's actually rendered in the browser and the features for the end users. :)

like image 83
Brandon Avatar answered Dec 07 '25 21:12

Brandon