Miscellaneous .NET Tips & Tricks
Make outlining work better
Roland Weigelt wrote a cool macro that makes outlining actually useful. Take a look at this screen shot:

Why the heck would I want to collapse the summary header of a method? Or the method for that matter? Or the entire namespace? The only thing I want to collapse is between #region and #endregion markers. Roland's RegionTools.vb macro allows you to outline only those things that are useful. Load it into the Macros IDE and save it as RegionTools. Then go into Tools - Options - Keyboard and assign the keyboard keys as he prescribes in his article. This macro works in VS 2003 and VS 2005 without modification.
1. ASP.NET Pages only work in Internet Explorer
The problem
I remember attending Microsoft DevDays when they demonstrated ASP.NET programming with C# using Visual Studio .NET. Everyone was wowed, me including. Coding for the web using a Visual Environment? Impossible!
Of course, the first question I wanted to know was "Does it work in Mozilla?" Everyone could see this problem coming from a mile away. Microsoft would render HTML that cripples other browsers. Of course. Duh. The speaker informed us that the pages worked very well in other browsers, since the server can detect other browsers, and send them appropriate "downlevel" HTML as they called it: A nice technical way of saying bad HTML that doesn't work.
Basically, Microsoft looks at the user-agent string sent by the browser and sends non-CSS based code. Not a bad idea in theory: they substitute tables for div tags, etc. But it does a bad job, causing things to run off the page, or get stuck on top of each other. Some of this had to be intentional since you can save the HTML it generates, and it won't even work in Internet Explorer!
The solution
Open up your .aspx page and switch to HTML source view. Add the following bolded code to the top of the "page" tag at the top of the file:
<%@ Page language="c#" ClientTarget="ie5"
Codebehind="TestForm.aspx.cs" AutoEventWireup="false"
Inherits="pmpControlsTest.TestForm" %>
This snippet of code is discussed in this MSDN Article. The ClientTarget option forces .NET to always render code for IE5. Another way to do this is to change the web.config file to map the Mozilla user-agent strings to use IE5 rendering. The problem there is that this doesn't do much for Amaya, Konqueror, Opera, Galeon, Safari, or any of the other web browsers with excellent CSS support. It's better to simply tell Microsoft to always render using CSS than to second-guess the browser.
2. Don't change object IDs in HTML view
If you need to change the ID of an asp control, do so using the Design view, even if it is difficult. Changing the ID in the design view will rename the member variables in the class, and warn you of duplicates. Changing the ID in the HTML may cause a new control to be created in the code, without the old one being removed. This can cause compile errors. Worse yet! Duplicate IDs may cause the editor to freeze for long periods of time, or even crash.
3. Switching between HTML and Design view harms pages
When you click the "HTML" or "Design" view buttons, ASP.NET reformats the page, updates the code, etc. Some of the changes are problematic. Specifically, I have noticed:
Many CSS styles are damaged
The "margin" style takes 4 parameters, but it drops it down to two.
The "width" style is auomatically converted to a deprectated "width" attribute in pixels. Anything using em, ex, etc becomes pixels.
CSS styles are capitalized (annoying, but no harm is done)XHTML causes unpredictable behavior
Tags may be removed, reordered, or changed.Undo/Redo is lost
So what can you do?
I have no idea! Please Email me and help!