Can I stop .NET eating IDs?

前端 未结 10 1484
我寻月下人不归
我寻月下人不归 2020-12-16 11:35

I\'m an Information Architect and JavaScript developer by trade nowadays, but recently I\'ve been getting back into back-end coding again. And, whilst trying to get an HTML

10条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-16 12:03

    A much better approach would be to use the ClientIDMode and set it to static. You can even set it for a specific page or globally in the web.config file. Then you never have to deal with this issue again and your JQuery is much cleaner.

    Top of page:

    <%@ Page Title="" ClientIDMode="Static" Language="C#" CodeBehind="..." Inherits="WebApplication1.WebForm2"  %>
    

    On control only:

    
    

提交回复
热议问题