ASP.NET 2.5 prefixing ctl00 and ASP.NET 4 not prefixing ctl00

后端 未结 4 423
后悔当初
后悔当初 2020-11-30 11:23

Does anyone know why ASP.NET 4 has dropped the ctl00 prefix on ASP controls?

Is there a setting I have missed?

4条回答
  •  庸人自扰
    2020-11-30 11:45

    In ASP.NET 4.0, they've introduced support for cleaner HTML syntax. You can read about it at Scott Gu's blog. If you want the classic model for Client IDs, you can adjust your web.config:

    
        
            
    

    And that'll make upgrading your application easier. You can change this per control (and per page) by using the Control.ClientIDMode property, which can also be set in the web config:

    
        
            
    

    AutoID renders the controls with the classic ASP.NET 2.0 model.

提交回复
热议问题