Disable auto id’s when copying ASP.NET controls

Don’t you hate it when you copy an ASP.NET server control without an ID, only to have it add one when you paste it?

For example, look at this code:

<asp:RequiredFieldValidator runat="server" />
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" />

I took the first line, copied it and pasted it, and got the second line. It’s rare that I need to reference a validator in my CodeBehind.

Here is the option to disable this functionality in the Visual Studio options (Tools->Options):

Disable Auto Ids Visual Studio

Simply uncheck the “Auto ID elements on paste in Source view” option.

Kick It!

1 Comment so far »

  1. Marc said,

    Wrote on May 2, 2008 @ 8:17 am

    Great tip! I always get annoyed when I have to copy and paste and I actually want the ID to be copied as well.

Comment RSS · TrackBack URI

Leave a Comment

Name: (Required)

E-mail: (Required)

Website:

Comment: