Atlas: exercise caution when using atlascontroltoolkit in updatepanel

Source: Internet
Author: User
To be accurate, exercise caution when dynamically loading controls/pages containing atlascontroltoolkit in updatepanel.

This should be a bug in the current version of Atlas.

When updatepanel is updated, the whole page is sent back (because the Asp.net page only has one form). After the operation is complete, only the HTML of the specified updatepanel is updated and the whole page is not updated. Therefore, you must be cautious when performing any operations on the entire page.

One example is to trigger a JS when updatepanel is complete, which cannot be completed directly by reposne. Write (JS. There are other solutions to this problem, but if you need to register a service reference on the page, the problem will come.

This is an example of using collapsiblepanelextender. After running, you can Source code Find the registration statement < Page xmlns: script = " Http://schemas.microsoft.com/xml-script/2005 " Xmlns: atlascontrolextender = " Atlascontrolextender " Xmlns: atlascontroltoolkit = " Atlascontroltoolkit " >
< References >
< Add SRC = " /Simpleframework3/webresource. axd? D = Ioi8xHST7lcO8WyMX8M1Qp01HVRZOqaHXtXlrWnSa8qBoUOooDu5bAELmzds1wN-b1-u5YUN4fWuliZSecml92eFfFLwwy_8K5S-adm8Yz5yBfnq0SF1wAuzr77-pr4C0 & amp; T = 632799165960000000 "   />
< Add SRC = " /Simpleframework3/webresource. axd? D = round & amp; T = 632823506800000000 "   />
< Add SRC = " /Simpleframework3/webresource. axd? D = round & amp; T = 632830263573107152 "   />
</ References >

In this case, the toolkit runs normally.

However, if you use this method, a problem occurs: place a button in an updatepanle on the page, then, execute an ascx page containing the Toolkit control application in the Processing Event to another updatepanel on this page. Run the command to check whether an error occurs.

The error message is like this: "the reference of the control XX namespace cannot be found ".

In this example, if we add a collapsiblepanelextender on the page (the ASPX page where the button is placed), this error will not occur. (Unfortunately, another error occurs: only one control is available. The results are different after each refresh. This problem is even more serious, which shows that there are still many problems in Atlas .)

The cause of the error is as follows:
1: The first time the page is loaded (there is no toolkit control on the page, so no reference is registered on the leaf)
2: buttonCodeAfter loading, the page cannot determine whether the ascx control to be loaded contains a toolkit. Therefore, the page is still not registered.
3: Load ascx and the result is displayed to the user. However, the control on ascx needs to be registered, but it does not exist on the page. Therefore, the atals runtime operation is abnormal.

The solution is to place several fake registration applications on the leaf surface before loading the control with toolkit.

 
It is related that atals is also very characteristic when processing JS functions on the page: it puts all JS into a block.
One of the consequences of doing so is that these JavaScript files may "interfere" with each other, and some JS Files written at ordinary times may not run here. Because some JS <! -- Comments may comment out your Js. This is also a problem I encountered during the development process.

We hope the next version will get better.

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.