Distinguish the Extender and behavior models in asp.net Ajax

Source: Internet
Author: User

asp.net Ajax presents a variety of models, with component, control, and behavior models on the client side, and Scirptcontrol and Extender models on the server. Each of these models has its own purpose, but it is important to note that the client model and the server-side model are independent of each other.

One of the key components of ASP.net Ajax is the Ajax control Toolkit, which includes a large number of extender and behavior. The Extender uses the behavior model presented by the Microsoft Ajax Library at the client using the Extender model asp.net ajax. The combination of extender and behavior models provides a wealth of results. So what exactly is the Extender model and what is the behavior model?

The server-side extender control is actually a class that inherits the controls class and implements the IExtenderControl interface, and we can also directly inherit the ExtenderControl class when we develop it, it has satisfied the above conditions and defined some common methods. The role of the extender control is simply to have the client output script, or rather, to tell Scriptmanager,scriptmanager that the script that needs to be executed on the page will choose a different way of output depending on the current situation (normal load or asynchronous loopback). Theoretically, extender can output arbitrary scripts. So we can only say that "extender in the Ajax control Tookit uses behavior on the client" and cannot say "Extender model uses behavior model on the client".

The behavior model provides rich functionality on the client, it operates entirely on client objects, and some may access Web service methods, but this does not affect the feature that it is only working on the client. Behavior is completely independent of server-side work, and the client (browser) simply executes the client's code in a step-by-step manner, and it does not know what server technology is generating the code.

Therefore, when we use AJAX control Tookit, we must also keep in mind the following:

There is no inevitable link between the Extender model and the behavior model.

Behavior can be executed independently of Extender.

All effects are provided by behavior.

The 1th article has already been explained above. In my previous article, the 2nd attribute was used in the modalupdateprogress control. I used modalpopupbehavior in the modalupdateprogress control, and my practice was to extract all the JavaScript files I needed from ModalPopupExtender and output them to the page as follows:

private IEnumerable<ScriptReference> GetExtenderReferences()
{
  if (extenderReferences == null)
  {
    lock (typeof(ModalUpdateProgess))
    {
      if (extenderReferences == null)
      {
         extenderReferences =
      (new ModalPopupExtender() as IExtenderControl).GetScriptReferences();
      }
    }
  }
  
  return extenderReferences;
}

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.