<pedrocorreia.net ⁄>

<Create Control Extenders in .NET ⁄ >

clicks: 3591 3591 2008-04-20 2008-04-20 goto programacao myNews programacao  Bookmark This Bookmark This

Microsoft's ASP.NET AJAX provides the ability to easily create your own AJAX-compatible controls and control extenders. An ASP.NET AJAX Server Control is similar to the standard old ASP.NET Server Control, but it adds client-side features and capabilities based on Microsoft's AJAX framework.

A "Control Extender" is a non-visual control that extends the capabilities of another control. One thing that all control extenders have in common is a property named TargetControlID, which is intended to reference a specific instance of the control type that it is extending. The ASP.NET AJAX Server Control Extender we'll create in this article extends the classic ASP.NET TextBox control with the ability to restrict its input to numeric characters only. To do this, it will utilize Microsoft's AJAX framework.

ASP.NET AJAX Server Controls inherit from the new ScriptControl class, while ASP.NET AJAX Server Control Extenders inherit from the nearly identical ExtenderControl class. The ScriptControl class (which inherits from WebControl) enables a number of AJAX-related functions. For example, it verifies that a ScriptManager control exists on the page. The ScriptControl class implements the IScriptControl interface.

In slight contrast, the ExtenderControl class inherits from the Control class, and implements the IExtenderControl interface. The IExtenderControl interface is virtually identical to the IScriptControl interface; they both define two functions: GetScriptDescriptors and GetScriptReferences.

The GetScriptDescriptors method is used to supply a list of related JavaScript files. Similarly, the GetScriptReferences method is used to supply a list of ScriptReference objects that represent each of those scripts. Both the ScriptControl and the ExtenderControl classes use these methods to ensure exactly one reference to each JavaScript file is output to the page's HTML during the render event.

Because of the similarities between the ScriptControl and ExtenderControl classes, the process of creating a basic AJAX Server Control is virtually identical to the process of creating a basic AJAX Server Control Extender. Once you've learned how to create one, you've essentially learned how to create both.

So, let's put all this theory to work and create an AJAX Server Control Extender that limits textbox entry to decimal characters only.

este é só um excerto do artigo, para aceder ao artigo completo, clique no link em baixo:
this is just a small excerpt from the article, to access the full article please click in the link below:


Subscribe News RSS  Subscribe News Updates by E-mail

myNews <myNews show="rand" cat="programacao" ⁄>

RouterJs: easy routing for your ajax Web applications new ...

RouterJs is a simple router for your ajax web apps. It's build upon History.js which means that Rout (...)

clicks: 18863 18863 2012-05-14 2012-05-14 goto url (new window) haithembelhaj.g... goto myNews programacao

Backbone computed properties new ...

This gist shows one way to implement read- and write-enabled computed properties on a Backbone Model (...)

clicks: 18461 18461 2012-05-13 2012-05-13 goto url (new window) https://gist.gi... goto myNews programacao

HTML5 jQuery Paint Plugin new ...

Websanova Paint is a HTML5 canvas based jQuery plugin. It allows you to free paint on a canvas area (...)

clicks: 29673 29673 2012-05-12 2012-05-12 goto url (new window) websanova.com/t... goto myNews programacao

Create Instagram Filters With PHP new ...

In this tutorial, I'll demonstrate how to create vintage (just like Instagram does) photos with PHP (...)

clicks: 18541 18541 2012-05-12 2012-05-12 goto url (new window) net.tutsplus.co... goto myNews programacao

Android Query new ...

Android-Query (AQuery) is a light-weight library for doing asynchronous tasks and manipulating UI el (...)

clicks: 18319 18319 2012-05-12 2012-05-12 goto url (new window) code.google.com... goto myNews programacao

Real-time Applications With Node.js and Socket.IO new ...

Hey everyone! Sorry about the long pause since the last blog post, life has been quite hectic for th (...)

clicks: 18845 18845 2012-05-11 2012-05-11 goto url (new window) codingcookies.c... goto myNews programacao

Sass vs. LESS vs. Stylus: Preprocessor Shootout new ...

CSS3 preprocessors are languages written for the sole purpose of adding cool, inventive features to (...)

clicks: 18308 18308 2012-05-11 2012-05-11 goto url (new window) net.tutsplus.co... goto myNews programacao

Gettings to know Backbone.ks new ...

In this series, we're going to learn how to build a fully functional contacts manager using Backbone (...)

clicks: 17377 17377 2012-05-10 2012-05-10 goto url (new window) net.tutsplus.co... goto myNews programacao