Visual Studio.NET mangling HTML

Status
Not open for further replies.

Pont

Ars Legatus Legionis
26,160
Subscriptor
Is there a way to make Visual Studio.NET stop mangling my HTML?

Every time I switch between Design mode and HTML mode on a web form, it chops off all my </dt> and </dd>. It also takes the / out of the /> in all my empty tags (
<link ... /> ).

Ideally, I'd like to have it use proper XHTML everywhere. Can I change the default template for web forms?
 

Pont

Ars Legatus Legionis
26,160
Subscriptor
Thanks Peter.

I found the autoformating options splattered around Tools -> Options -> Text Editor -> Apply Auto Formatting -> (uncheck both checkboxes)

I edited the template in C:\Program Files\Microsoft Visual Studio .NET\Common7\IDE\NewScriptItems\aspxpage.aspx, which looked like the default template, but that didn't work :( Most displeasing. Well, no product is perfect, I guess.

(but VS.NET is damn nice).
 

HitScan

Ars Tribunus Militum
2,523
Subscriptor++
Tools -> Options -> Text Editor -> Apply Auto Formatting -> (uncheck both checkboxes)
Aha. I was turning stuff off in the HTML specific section, to no avail. This doesn't effect the code editing does it? because I use the fact that it auto tabs/cases everything A LOT.

You left out my favorite "feature" if you put "padding:0px" or margin, or whatever in the style attributes, it would expand them out fully. i.e. "padding-top: 0px; padding-bottom: 0px; padding-right: 0px; padding-left: 0px;" I'd like to beat the fucker who thought that was a good idea with a tire iron.

<span style="font-size: 150% !important; color: red;">Why make something sooo cool only to fuck it up in the details?!?!</span>

Damnit it pisses me off. :mad:

HitScan
 

Pont

Ars Legatus Legionis
26,160
Subscriptor
(When I stop sinking money into my 944, I gotta subscribe just so I can post big red text :D )

Generally, I try and use avoid styling the individual items completely and use stylesheets to handle all that. It lets ME handle the cross-browser issues (which may be a downside, depending on your point of view) and it lets me control things from a single location.
 

Pont

Ars Legatus Legionis
26,160
Subscriptor
Bah! :mad: VS.NET still insists on fucking up my code if I actually use the designer for anything (like assigning events to a button).

It seems to randomly decide that attributes don't need quotes.
It seems to randomly decide to re-indent or unindent my perfectly indented code.
It takes my XHTML and turns it into bastardized HTML 4.01.

:mad: :mad: :mad:

How does one say, assign a button's onClick event without going into the designer?

The way I see it, there's no practical way to use VS.NET to build XHTML compliant sites. You just have to bend over and take the crappy-but-not-as-bad-as-frontpage code it turns your beautiful code into.
 

indigo

Well-known member
5,606
onClick?

You mean like this:

Code:
<input type=button name=Search value=Search onClick='javascript:setMode("Search")'>

:confused:

You just... write it?

I'm probably misinterpreting something again... I do that alot, no offence intended. ;)

What bugs me most about VS.NET (and I don't use design view, so I haven't run into the probs you guys have thankfully), is the syntax highlighting. It rechecks the entire page when you copy&paste something, which really seems to bog the app down... probably would handle ASP.NET pages with code-behind much more smoothly, but NT4 mixxed stuff for me for now...
 

martin007

Ars Tribunus Militum
2,783
Originally posted by Kurt:
If you just set the "Onclick" attribute of your asp:Button to whatever function you'd like to run, it will work fine. You don't have to worry about assigning the event.
Not if your code is inherited from a custom class somewhere. But you're right - if you're just specifying the function in the <script runat="server"> tag within the .aspx or a codebehind .cs (or .vb) then this will be sufficient.
 

martin007

Ars Tribunus Militum
2,783
Originally posted by Kurt:
If you just set the "Onclick" attribute of your asp:Button to whatever function you'd like to run, it will work fine. You don't have to worry about assigning the event.
Well I'll be dipped in shit and rolled in bread crumbs!

Kurt, sorry man, you were right the whole time.

/walks of wondering what the hell I was thinking
 
Status
Not open for further replies.