10.02.2014 Views

Beginning Ajax With ASP.NET (2006).pdf

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Control Extenders<br />

<strong>With</strong> <strong>ASP</strong>.<strong>NET</strong>, there is a set of controls that developers have become fairly familiar with. These controls<br />

include things like the textbox, label, drop-down list box, and many others. One of the questions that<br />

Atlas brings to the table is how to provide additional functionality to these controls, while maintaining<br />

the programming model that developers have come to be familiar with. Into this problem step control<br />

extenders. <strong>With</strong> control extenders, client-side functionality is added to an existing server-side control,<br />

while maintaining the server-side programming model. There are numerous examples of these extensions<br />

of existing controls.<br />

You are going to see the AutoComplete extender control in the next section. The AutoComplete extender<br />

control is designed to extend the capabilities of an <strong>ASP</strong>.<strong>NET</strong> Textbox control. The AutoComplete control<br />

will extend the functionality of the Textbox control by hooking it to a web service to get information.<br />

In Chapter 12, the Drag and Drop extender will be presented. It will provide Drag and Drop support<br />

through Atlas.<br />

AutoComplete<br />

One of the classic examples of <strong>Ajax</strong> has been a textbox that is similar in concept to the Windows combo<br />

box (similar, but not quite the same). This feature has been popularized by the Google Suggest service.<br />

Atlas provides the capability to extend the in <strong>ASP</strong>.<strong>NET</strong> 2.0. This extension takes input<br />

from the textbox, passes the text to the web service, and the web service returns a list of possible items,<br />

similar to the Windows Combo Box. Take a look at the following simple example. Here is the <strong>ASP</strong>X code.<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

Look at what is being specified.<br />

Atlas Controls<br />

❑<br />

❑<br />

❑<br />

There is an <strong>ASP</strong>.<strong>NET</strong> textbox. This is the standard textbox in <strong>ASP</strong>.<strong>NET</strong>.<br />

There is a new type of server control. This is an extender control, and specifically the<br />

AutoCompleteExtender. It is a server control that acts on the <strong>ASP</strong>.<strong>NET</strong> textbox. The extender<br />

control “extends” the functionality in the textbox.<br />

There are series of properties specified within the tag:<br />

❑<br />

❑<br />

❑<br />

TargetControlID — The TargetControlID is the control that will be the target of the<br />

extender.<br />

ServicePath — The ServicePath property is the path to the web service that will be<br />

called.<br />

ServiceMethod — The ServiceMethod property is the name of the function within the<br />

web service.<br />

293

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!