Home Search Member List Faq Register Login  
UltimateAjax
AjaxToolkit AutoCompleteExtender with UltimateAjax control doesnt work after postback

Thread Starter: ajaxdeveloper2010   Started: 07-12-2010 12:51 PM   Replies: 3
 Karamasoft Support Forums » General Discussions » UltimateAjax » AjaxToolkit AutoCompleteExtender with UltimateAjax control doesnt work after postback
 Printable Version    « Previous Thread   Next Thread »
  12 Jul 2010, 12:51 PM
ajaxdeveloper2010 is not online. Last active: 7/13/2010 6:44:12 AM ajaxdeveloper2010

Not Ranked
Joined on 07-12-2010
Posts 2
AjaxToolkit AutoCompleteExtender with UltimateAjax control doesnt work after postback
I have textbox control with AjaxToolkit AutoCompleteExtender under UltimateAjax control on my webform. The autocompleteextender works fine when page loads for first time. After UltimateAjax postback, autocompleteextender stops working. I have to reload entire page to get it working.

Did anyone had this issue resolved? Any help is appreciated.

Thank you in advance.

Below is the code for reference

======================================================
Default.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register TagPrefix="cc1" Namespace="Karamasoft.WebControls.UltimateAjax" Assembly="UltimateAjax" %>
<%@ Register TagPrefix="cc2" Namespace="Karamasoft.WebControls" Assembly="UltimatePanel" %>
<!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 runat="server">
<title>AutoComplete with UltimateAjax</title>
<style type="text/css">
/*AutoComplete flyout */
.autoCompleteCompletionListElement
{
margin: 0px !important;
background-color: inherit;
color: windowtext;
border: buttonshadow;
border-width: 1px;
border-style: solid;
cursor: 'default';
overflow: auto;
width: 100%;
text-align: left;
list-style-type: none;
}
/* AutoComplete highlighted item */
.autoCompleteHighlightedListItem
{
background-color: #ffff99;
color: black;
padding: 1px;
}
/* AutoComplete item */
.autoCompleteListItem
{
background-color: window;
color: windowtext;
padding: 1px;
}
</style>

<script language="javascript" type="text/javascript">
function onItemSelected() {
DoUltimateCallback('<%=UltimateAjax1.ClientID %>', "argument");
}
</script>

</head>
<body>
<form id="form1" runat="server">
<aspTongue TiedcriptManager ID="ScriptManager1" runat="server"></aspTongue TiedcriptManager>
<cc1:UltimateAjax ID="UltimateAjax1" runat="server" OnCallback="UltimateAjax1_Callback">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="20%">
AutoCompleteTextBox:
</td>
<td>
<asp:TextBox ID="autoCompleteTextbox" runat="server" Width="100px"></asp:TextBox>
<AjaxToolKit:AutoCompleteExtender runat="server" ID="AutoCompleteExtender1" TargetControlID="autoCompleteTextbox"
BehaviorID="AutoCompleteEx" ServicePath="AutoComplete.asmx" ServiceMethod="GetCompletionList" MinimumPrefixLength="2"
CompletionInterval="1000" EnableCaching="true" CompletionSetCount="20" CompletionListCssClass="autoCompleteCompletionListElement"
CompletionListItemCssClass="autoCompleteListItem" CompletionListHighlightedItemCssClass="autoCompleteHighlightedListItem"
ShowOnlyCurrentWordInCompletionListItem="true" OnClientItemSelected="onItemSelected">
</AjaxToolKit:AutoCompleteExtender>
</td>
</tr>
</table>
</cc1:UltimateAjax>
</form>
</body>
</html>


======================================================
Default.aspx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Karamasoft.WebControls.UltimateAjax;

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}

protected void UltimateAjax1_Callback(object sender, CallbackEventArgs e)
{
autoCompleteTextbox.Text = e.Argument;
}
}

======================================================
AutoComplete.asmx

<%@ WebService
Language="C#"
CodeBehind="~/App_Code/AutoComplete.cs"
Class="AutoComplete" %>

======================================================

AutoComplete.cs

using System;
using System.Collections.Generic;
using System.Web.Services;

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.Web.Script.Services.ScriptService]
public class AutoComplete : WebService
{
public AutoComplete()
{
}

[WebMethod]
public string[] GetCompletionList(string prefixText, int count)
{
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();
}
}

  
  12 Jul 2010, 4:47 PM
Karamasoft is not online. Last active: 5/8/2018 10:36:45 AM Karamasoft

Top 10 Posts
Joined on 09-05-2004
Posts 6,820
Re: AjaxToolkit AutoCompleteExtender with UltimateAjax control doesnt work after postback
UltimateAjax does not support ASP.NET AJAX Toolkit components. If you want to use the ASP.NET AJAX Toolkit components such as AutoCompleteExtender, you should move it outside the UltimateAjax control and use the UpdatePanel component provided by the ASP.NET Framework.
  
  13 Jul 2010, 6:39 AM
ajaxdeveloper2010 is not online. Last active: 7/13/2010 6:44:12 AM ajaxdeveloper2010

Not Ranked
Joined on 07-12-2010
Posts 2
Re: AjaxToolkit AutoCompleteExtender with UltimateAjax control doesnt work after postback

Thank you for quick response. Does UltimateAjax support JQuery?


  
  13 Jul 2010, 11:07 AM
Karamasoft is not online. Last active: 5/8/2018 10:36:45 AM Karamasoft

Top 10 Posts
Joined on 09-05-2004
Posts 6,820
Re: AjaxToolkit AutoCompleteExtender with UltimateAjax control doesnt work after postback
No, it doesn't support jQuery. Sorry for the inconvenience.
  
 Page 1 of 1 (4 items)
Karamasoft Support Forums » General Discussions » UltimateAjax » AjaxToolkit AutoCompleteExtender with UltimateAjax control doesnt work after postback

You can add attachments
You can post new topics
You can reply to topics
You can delete your posts
You can edit your posts
You can create polls
You can vote in polls
Forum statistics are enabled
Forum is unmoderated

© 2002-2018 Karamasoft LLC. All rights reserved.