Using the new autocomplete from the client side

Published Mon, Jan 29 2007 16:19

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" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Untitled Page</title>
</head>
<body>
<script type="text/javascript" src="../MicrosoftAjax.debug.js">
</script>
<script type="text/javascript" src="blocking.js">
</script>
<script type="text/javascript" src="common.js">
</script>
<script type="text/javascript" src="timer.js">
</script>
<script type="text/javascript" src="BaseScripts.js">
</script>
<script type="text/javascript" src="PopupBehavior.js">
</script>
<script type="text/javascript" src="autocompletebehavior.js">
</script>
Introduza o nome: <input type="text" id="nome" />
<script type="text/javascript">
  Sys.Application.add_init( handleInit );
  function handleInit( sender, e ){
   $create(
         AjaxControlToolkit.AutoCompleteBehavior, //tipo de componente
         {"completionInterval": 2, "minimumPrefixLength":1,
           "serviceMethod": "ObtemPalavras", "servicePath":"autocomplete.asmx" }, //propriedades
           null, null,  $get("nome") );
   }
</script>
</body>
</html>

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...

Filed under:

Leave a Comment

(required) 
(required) 
(optional)
(required) 
If you can't read this number refresh your screen
Enter the numbers above:  

Search

This Blog

Tags

Community

Archives

Syndication

Email Notifications

News




  • View Luis Abreu's profile on LinkedIn


    Follow me at Twitter

    My books

    Silverlight 4.0: Curso Completo

    ASP.NET 4.0: Curso Completo

    Portuguese LINQ book cover

    Portuguese ASP.NET 3.5 book cover

    Portuguese ASP.NET AJAX book cover

    Portuguese ASP.NET AJAX book cover