Jan 29

Using the new autocomplete from the client side

Posted in MS AJAX      Comments Off on Using the new autocomplete from the client side

As you”ve heard, the AutoComplete has been moved to the ajax toolkit. although this sounds like a logical decision (yes, I”m agreeing with MS on this one), it made my pages stopped working. the bad news is that in order to get the client part working, you do need several imports from the ajax toolkit. here”s a demo page:

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “”>
<html xmlns=”” >
<title>Untitled Page</title>
<script type=”text/javascript” src=”../MicrosoftAjax.debug.js”>
<script type=”text/javascript” src=”blocking.js”>
<script type=”text/javascript” src=”common.js”>
<script type=”text/javascript” src=”timer.js”>
<script type=”text/javascript” src=”BaseScripts.js”>
<script type=”text/javascript” src=”PopupBehavior.js”>
<script type=”text/javascript” src=”autocompletebehavior.js”>
Introduza o nome: <input type=”text” id=”nome” />
<script type=”text/javascript”>
  Sys.Application.add_init( handleInit );
  function handleInit( sender, e ){
         AjaxControlToolkit.AutoCompleteBehavior, //tipo de componente
         {“completionInterval”: 2, “minimumPrefixLength”:1,
           “serviceMethod”: “ObtemPalavras”, “servicePath”:”autocomplete.asmx” }, //propriedades
           null, null,  $get(“nome”) );

well,that”s what happen when you start using CTPs 🙂 at the end, and if you do want to keep your pages working, you do need to make some changes…