Scriptmanagerproxy in ASP. NET Ajax

Source: Internet
Author: User

Today, I came across a concept: the scriptmanagerproxy control in Asp.net Ajax. The framework specifies that only one scriptmanager control can be used on An ASPX page. To use Ajax, a page must have at least one scriptmanager control. However, if the master page is used, ASP is used as needed on the master page. net Ajax feature, defines a scriptmanager control, while the content page also needs to use Ajax features, you can define a scriptmanagerproxy control on the Content Page to replace scriptmanager.

So I tried to define the scriptmanager control on the master page and use the updatepanel control. The scriptmanager control is also defined on the content page, and the updatepanel control is also used. Then build. However, an error is reported during running, which is also very straightforward, that is, a page cannot contain two scriptmanager controls at the same time. So I think since the master page is actually equivalent to a direct reference, it has, and I don't need to define it in the content page, so I won't be able to simply use updatepanel. I tried it!

Then I tried the scriptmanagerproxy mentioned above, which is also successful.

There is no need to use scriptmanagerproxy and use it. The effect seems to be the same. What is the difference between the bottom? The convenience of the image is of course not easy to worry about, and it is certainly useful in essence.

 

I checked it and thought about it. It is almost because of the following reasons:

Since the master page can be used as a master page, it is not suitable for defining some special properties of specific pages. Specifically, for scriptmanager, Ajax applications on the content page may need to specify some special web services, or reference some special scripts and define some special attributes. At this time, it is unrealistic and unreasonable to add each content page to the master page. Therefore, you need to define it on the current content page. At this time, it cannot violate the rule that only one sm (~~) can exist on a page (~~~) The control principle can only be implemented through SMP.

 

Of course, if I don't need a special definition that cannot meet the requirements of the master page, I can simply omit the SMP control.

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.