How do I prevent Visual Studio from renaming my co

2019-01-11 22:33发布

问题:

If I paste something like

<asp:DropDownList ID="DropDownListExpirationDate" runat="server" />

onto an ASPX file that already has a control with ID DropDownListExpirationDate, it will rename the newly-pasted control as DropDownList1.

<asp:DropDownList ID="DropDownList1" runat="server" />

I'd rather it didn't. I'd rather it just paste exactly what I copied.

Is there a way to disable this feature?

回答1:

After a quick check(!)....

Tools > Options > Text Editor > HTML > Miscellaneous

Uncheck 'Auto ID elements on paste in Source view'.