ASP.NET 2.5 prefixing ctl00和ASP.NET 4不是prefixing ctl00 [英] ASP.NET 2.5 prefixing ctl00 and ASP.NET 4 not prefixing ctl00

查看:176
本文介绍了ASP.NET 2.5 prefixing ctl00和ASP.NET 4不是prefixing ctl00的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道为什么ASP.NET 4已经下降了 ctl00 preFIX ASP的控制?

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

有我错过了设置?

推荐答案

在ASP.NET 4.0中,他们已经推出了更清洁的HTML语法的支持。你可以阅读一下<一个href=\"http://weblogs.asp.net/scottgu/archive/2010/03/30/cleaner-html-markup-with-asp-net-4-web-forms-client-ids-vs-2010-and-net-4-0-series.aspx\">at斯科特谷的博客。如果您想为客户端ID的经典机型,可以调整你的web.config:

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:

<configuration>
    <system.web>
        <pages controlRenderingCompatibilityVersion="3.5" />

这会让你的升级应用程序更容易。您可以通过使用 Control.ClientIDMode 属性,它也可以在web配置设置每个控件(每页)更改此:

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:

<configuration>
    <system.web>
        <pages clientIDMode="AutoID|Predictable|Static|Inherit" />

自动识别渲染控制采用经典的ASP.NET 2.0的模式。

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

这篇关于ASP.NET 2.5 prefixing ctl00和ASP.NET 4不是prefixing ctl00的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆