Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent ID autogeneration on copy-paste in Visual Studio 2008 ASP.NET Web Form

If I have the following in an ASP.NET Web Form:

<asp:TextBox runat="server" ID="tbxUser"/>

and I copy and paste that line in the same page, I usually get the following:

<asp:TextBox runat="server" ID="TextBox1"/>

Obviously, nobody is going to name their controls in that way (if you don't want to name a textbox, simply don't asign an ID to it), and it's not nice having to change the ids of pasted controls. The same happens if I copy a control without an explicit ID, VS simply generates one for me.

Is there any way of preventing VS from autogenerating IDs when I copy-paste ASP.NET code?

like image 789
Diego Avatar asked Mar 04 '10 16:03

Diego


3 Answers

Options, Text Editor, HTML, Misc, Auto ID on Paste

By the way, the most similar article contains just the same question (answered, of course). Be more careful next time :)

like image 102
wRAR Avatar answered Oct 14 '22 11:10

wRAR


If you're on Visual Studio 2013, see this stackoverflow question:

Disable "Auto ID elements" in Visual Studio 2013

which basically points to a bug raised with Microsoft (disabling auto id has been removed from VS 2013):

http://connect.microsoft.com/VisualStudio/feedback/details/806446/asp-net-web-forms-development-unable-to-disable-auto-id-generation-on-paste-using-new-version-of-visual-studio-2013

like image 41
Thierry_S Avatar answered Oct 14 '22 11:10

Thierry_S


Visual Studio 2017 doesn't seems to have a way to turn this off. If anybody knows the way, kindly post for VS 2017. Thank you.

like image 3
TPG Avatar answered Oct 14 '22 11:10

TPG