I am playing around with MVC 2 a bit and was trying to hook up a text box to the Microsoft AjaxToolkit AutoCompleteBehavior.
and I cannot get the java script to fire. Originally I thought that my scrpt references were wrong but have pointed the scripts to the CDN versions.
it looks like I never enter the Sys.Application.add_init(function () { where I create my object.
could anyone see if I am missing something simple. or am I just doing it wrong?
<script src="http://ajax.microsoft.com/ajax/act/40412/extended/ExtenderBase/BaseScripts.js" type="text/javascript"></script>
<script src="http://ajax.microsoft.com/ajax/act/40412/extended/Common/Common.js" type="text/javascript"></script>
<script src="http://ajax.microsoft.com/ajax/act/40412/extended/Animation/Animations.js" type="text/javascript"></script>
<script src="http://ajax.microsoft.com/ajax/act/40412/extended/Animation/AnimationBehavior.js" type="text/javascript"></script>
<script src="http://ajax.microsoft.com/ajax/act/40412/extended/PopupExtender/PopupBehavior.js" type="text/javascript"></script>
<script src="http://ajax.microsoft.com/ajax/act/40412/extended/Compat/Timer/Timer.js" type="text/javascript"></script>
<script src="http://ajax.microsoft.com/ajax/act/40412/extended/AutoComplete/AutoCompleteBehavior.js" type="text/javascript"></script>
<script type="text/javascript">
Sys.Application.add_init(function () {
$create(Sys.Extended.UI.AutoCompleteBehavior
, { "delimiterCharacters": ""
, "serviceMethod": "ProductNameSearch"
, "servicePath": "/ProductService.asmx"
, "minimumPrefixLength": 1
}
, null
, null
, $get("query"));
});
</script>
<script src="/Scripts/MicrosoftAjax.js" type="text/javascript"></script>
<script src="/Scripts/MicrosoftMVCAjax.js" type="text/javascript"></script>
<%using (Ajax.BeginForm("ProductSearchAC"
, new AjaxOptions { UpdateTargetId = "results" }))
{ %>
<%=Html.TextBox("query",null, new {size=40}) %>
<input type="submit" />
<%} %>
<div id="results">
</div>