Fog Creek Software
Discussion Board




Welcome! and rules

Joel on Software

VS.NET IDE erasing my stylesheet

OK, has anyone seen this?

I have a usercontrol with a stylesheet on the ascx side as such:

<style id="MyStyle" type="text/css">
    .ShowOnlySomeTimes { DISPLAY: <%=IIF(MyMode = Modes.ShowMode, "inline", "none")%> }
</style>
<asp:panel>blah blah....

I use the .ShowOnlySomeTimes to wrap certain elements that are only to be initially shown if there is a specific mode (a property on the .ascx) set to a specific enumeration.

However, periodically, VS.NET will rewrite it to look like so:

<style id="MyStyle" type="text/css">
    .ShowOnlySomeTimes { }
</style>
<asp:panel>blah blah....

And I have the sourcesafe checkin's to know that I'm not crazy.

I understand I could do all of this with server control literals and such, but I just need to know if anyone knows why this particular approach (though not exactly smooth)  is doomed.

My only guess is that VS.NET sees the { DISPLAY: <%...%> } as a garbage style and tries to axe it.  I have custom (read: bogus) html attributes on <asp:textbox>'s and the IDE doesn't erase those.  Are Styles holy ground?

When the IDE doesn't rewrite the style, it works perfectly.  Any ideas?

Slit My Wrists
Thursday, July 08, 2004

VS.NET rewrites code.  Here are the 2 scenarios in which it will RUIN your work.

- When switching from design view to code view

- when using the 'properties' pallete

FOR SHAME, MICROSOFT! FOR SHAME!

Sassy
Thursday, July 08, 2004

I agree wholeheartedly.

But a note: don't forget that it's easy to screw up like this, by parsing raw data into data structures, then rewriting the parsed information you kept.  Good algorithm, horrible result.

But yes, they should also know better by now :(

DaveG
Thursday, July 22, 2004

*  Recent Topics

*  Fog Creek Home