Visual studio Tip #5: “Surround with…” in ASP.NET 4.0

As an ASP.NET developer, you certainly found yourself in the following situation.
You have a number of mark-up elements in your page which should be hidden/updated/… all at once.
The solution is to put them in a panel or updatepanel.

In previous versions of Visual Studio you had to manually type the tags to surround your mark-up with, causing a lot of copy pasting and scrolling sometimes.
Visual Studio 2010 now offers the “Surround with…” option in your ASP.NET mark-up.
We already knew this feature from VB.NET or C#.

Let’s say you have a panel which has to be placed in an updatepanel:

After selecting the panel mark-up you can right click on it (or use the shortcut CTRL + K, S) to show the following context menu:

You can chose which snippet needs to be used for the surrounding.
Selecting the “updatepanel” snippet gives the following result:

It’s just a small feature, but it should already have been in Visual Studio for a long time!