Extend ASP.NET AJAX Client-Side Function - The Server-Side Way
page 2 of 11
by Xianzhong Zhu
Feedback
Average Rating: 
Views (Total / Last 10 Days): 55203/ 215

About ExtenderControl

According to the online materials and all possible existing references, there are typically two means, from the server side, to enable us to expand the client-side functionalities of ASP.NET AJAX framework. The first path to follow is to create a separate ExtenderControl (Listing 1 gives the class definition and Figure 1 depicts a more vivid hierarchical tree for it), which encapsulates client capabilities in a behavior and that can then be attached to an ASP.NET Web server control.

Listing 1

public abstract class ExtenderControl : Control, IExtenderControl{
      // Fields
      private IScriptManagerInternal _scriptManager;
      private string _targetControlID;
 
      // Methods
      protected ExtenderControl();
      internal ExtenderControl(IScriptManagerInternal scriptManager);
      private static UpdatePanel FindUpdatePanel(Control control);
      protected abstract IEnumerable<ScriptDescriptor> 
       GetScriptDescriptors(Control targetControl);
      protected abstract IEnumerable<ScriptReference> GetScriptReferences();
      protected override void OnPreRender(EventArgs e);
      private void RegisterWithScriptManager();
      protected override void Render(HtmlTextWriter writer);
      IEnumerable<ScriptDescriptor> IExtenderControl.GetScriptDescriptors(
       Control targetControl);
      IEnumerable<ScriptReference> IExtenderControl.GetScriptReferences();
 
      // Properties
      private IScriptManagerInternal ScriptManager { get; }
       [DefaultValue(""), ResourceDescription("ExtenderControl_TargetControlID"), 
       IDReferenceProperty, Category("Behavior")]
      public string TargetControlID { get; set; }
       [Browsable(false), 
       DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), 
       EditorBrowsable(EditorBrowsableState.Never)]
      public override bool Visible { get; set; }
}

 

Figure 1 - The hierarchical tree related to ExtenderControl

As for the IExtenderControl Interface and all related details, we will delve into them later on. For now, what we should be aware of is that an extender control itself is not part of its associated controls; therefore, we can create a single extender control that can be associated with several types of ASP.NET Web server controls.


View Entire Article

User Comments

No comments posted yet.






Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2019 ASPAlliance.com  |  Page Processed at 2019-05-22 7:03:37 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search