Hi there,
I try to implement AJAX Toolkit "asp:AutoCompleteExtender" function in DNN 560 (VS2008) C#. I'm adding the Scriptmanager ScriptReference in page load programmatically (looked at sample on http://adefwebserver.com/dotnetnukehe...
But
the issue is the Autocomplete function is not showing the pull-down menu, it even doesn't hit the breakpoints in functions. I copied the autocomplete function code from ajax.asp.net, which is working fine but I think I couldn't get fix the integration with DNN.
So the AUTOCOMPLE.ASMX code is native code from ASp.AJAX.NET which works fine... It prompts when you type 2 or more charachers in textbox
I've also added Breakpoints to see whether the code is hit, but the code-behind code is not hit.
Is there something wrong with ServicePaht or whatever?????
Please advice?
-----------------------------------------------
Agenda_View.ASCX.CS code
-----------------------------------------------
protected void Page_Load(object sender, System.EventArgs e)
{
if (DotNetNuke.Framework.AJAX.IsInstalled()){
DotNetNuke.Framework.AJAX.RegisterScriptManager();
ScriptManager objScriptManager = ScriptManager.GetCurrent(this.Page);
ServiceReference objServiceReference = new ServiceReference();
objServiceReference.Path = @"~/DesktopModules/Agenda/AutoComplete.asmx";
objScriptManager.Services.Add(objServiceReference);
}
-----------------------------------------------
AutoComplete.AsmX - CODE
-----------------------------------------------
///
[WebService(Namespace = http://tempuri.org/)]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
[System.Web.Script.Services.ScriptService]
public class AutoComplete : System.Web.Services.WebService
{
public AutoComplete()
{
System.Diagnostics.Debugger.Break();
}
[WebMethod]
public static string[] GetCompletionList(string prefixText, int count)
{
System.Diagnostics.Debugger.Break();
if (count == 0)
{
count = 10;
}
if (prefixText.Equals("xyz"))
{
return new string[0];
}
Random random = new Random();
List<string> items = new List<string>(count);
for (int i = 0; i < count; i++)
{
char c1 = (char)random.Next(65, 90);
char c2 = (char)random.Next(97, 122);
char c3 = (char)random.Next(97, 122);
items.Add(prefixText + c1 + c2 + c3);
}
return items.ToArray();
}
}
---------------------------------------------
Agenda_View.ASCX DESIGN code
---------------------------------------------
<asp:TextBox runat="server" ID="myTextBox" AutoCompleteMode="Suggest" Width="350" />
<asp:AutoCompleteExtender runat="server" BehaviorID="AutoCompleteEx" ID="autoComplete1" TargetControlID="myTextBox" ServicePath="~/DesktopModules/Agenda_Invoer/AutoComplete.asmx"
ServiceMethod="GetCompletionList" MinimumPrefixLength="2" CompletionInterval="1000" EnableCaching="true" CompletionSetCount="20"
CompletionListCssClass="autocomplete_completionListElement" CompletionListItemCssClass="autocomplete_listItem" CompletionListHighlightedItemCssClass="autocomplete_highlightedListItem"
DelimiterCharacters=";, :" ShowOnlyCurrentWordInCompletionListItem="true">
</asp:AutoCompleteExtender>