Do not use ASP. NET Ajax

Source: Internet
Author: User
In ASP. NET Ajax, do not use <xhtmlconformance mode = "Legacy"/>

The vs 2003 web project is automatically transplanted to VS 2005. <xhtmlconformance mode = "Legacy"/> is also configured in the web. config file.

When using the ASP. NET Ajax updatepanel control, this strange behavior sometimes involves page-wide PostBack, not just incremental local updates.

When you open your web. config file, you will see the <xhtmlconformance/> element, as shown in the following figure:

<Configuration>

<System. Web>
<Xhtmlconformance mode = "Legacy"/>
</System. Web>

</Configuration>

Many server-side controls in ASP. NET 1.0 and 1.1 do not output XHTML-compatible identifiers. ASP. NET 2.0 has changed this. By default, all server-side controls will output XHTML-compatible identifiers.

However, one thing we noticed in the early ASP. NET 2.0 Beta was that when we upgraded the customer application, many applications would assume that the page output is not compatible with XHTML. If we change the default output of the control on our server to be compatible with XHTML, it sometimes modifies the visual display of the page. For the purpose of backward compatibility, we have added the above <xhtmlconformance> Settings, allowing developers to set controls in the legacy mode (that is, with ASP. NET 1.1, it outputs non-XHTML identifiers), transitional mode (XHTML transitional), or strict mode (XHTML strict.

By default, when you use vs 2003 to upgrade to VS 2005 web project porting wizard (whether it is a website or web application project), your web. this legacy configuration is added to the config file.

Solution:

Unless you know that your website is running in XHTML mode and there is a problem (but you don't have time to correct it. remove <xhtmlconformance> from the config file, or explicitly set it to transitional or strict.

This will make your HTML output conform to the standard. In addition, this will also cause the HTML output of your server control to be well formed, that is, the start tag always matches the end tag. This is especially important when you use Ajax technology to dynamically Replace the content of some HTML elements on your page. Otherwise, the client Javascript script sometimes cannot clearly understand the container elements, leading to errors. It will also ensure that ASP. NET Ajax will work properly on your website.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.