Sibusiso Shongwe Sibusiso Shongwe - 1 year ago 68
ASP.NET (C#) Question

How do i prevent visual studio from renaming my id attributes?

I have recently migrated to visual studio 2015 community and my JavaScript no longer works because visual studio 2015 renames id attributes based on their content placeholders for example

will become
at runtime.

How do I turn this off, am using c# and asp.Net ?

Answer Source

You can set the ClientIDMode to Static, f.e. via page directive:

<%@ Control Language="C#"  ClientIDMode="Static" AutoEventWireup="true" CodeBehind="PageName.ascx.cs" Inherits="WepAppName.PageName" EnableViewState="false" %>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download