Showing posts with label autocompleteextender. Show all posts
Showing posts with label autocompleteextender. Show all posts

Wednesday, March 28, 2012

AJAX Beta 1.0 - Odd Behaviour of AutoCompleteExtender

Moving to Beta 1.0 has not been a trivial task. I've been using AutoCompleteExtender for a while now and it was working quite well with the CTP. Upgrade to AJAX Beta 1.0 and everything stops working, and this is WITH the Value-Add CTP included as well.

Here is what I ran into:

My webservice method was never being called. I spent 3 hours on trying to figure out why my complex form wasn't calling the webservice when I'd put in a value. Turns out that with the CTP the parameter names on the web method didn't matter, but theyDO matter in beta 1.0.

Originally I had the following signature:

Public Function GetCustomers(ByVal prefixTextAs String,ByVal maxCountAs Integer)As String()
I then switched this this method signature and everything started working:
Public Function GetCustomers(ByVal prefixTextAs String,ByVal countAs Integer)As String()

I then went back and fixed all of my other autocompletes, but one still doesn't work. If you try and use the AutoComplete within a gridview control (I'm trying to let my user add rows by providing a row at the bottom with fields), the control never gets registered for autocomplete.

This used to work in the Atlas CTP. I've tried everything I can think of but no luck fixing this one.

Last thing, when a form has an AutoCompleteExtender and I click on a asp:hyperlink I get an exception thrown by WebResource.axd in the following code:

Sys.UI.DomElement.getVisible = function Sys$UI$DomElement$getVisible(element) {/// <param name="element" type="Sys.UI.DomElement"></param> /// <returns type="Boolean"></returns> var e = Function._validateParams(arguments, [ {name:"element", type: Sys.UI.DomElement} ]);if (e)throw e;return (element.style.visibility !=='hidden');}
The exception thrown is:
Microsoft JScript runtime error: Sys.ArgumentUndefinedException: Value cannot be undefined.Parameter name: element

All in all this has been a pretty frustrating upgrade. The CTP had been working so well for so long that I felt like moving to the Ajax Beta would be a safe proposition...
Charles

Another bugs:

I have AutoCompleteExtender in Wizard control on 3rd step. When I load a page, Javascript error occurs:
1if (!type.inheritsFrom(Sys.Component)) {
2 throw Error.argument('type', String.format(Sys.Res.createNotComponent, type.getName()));
3 }
4if (type.inheritsFrom(Sys.UI.Behavior) || type.inheritsFrom(Sys.UI.Control)) {
5 if (!element) throw Error.argument('element', Sys.Res.createNoDom);
6 }
on line 6 (i code it is line 1960):
Sys.ArgumentException: Value must not be null for Control and Behaviors.
Parameter name: element

I really don't know what to do with it


For us it has been the same. However, changing parameters names does not do the trick...

Can you please provide a short fragement of an ASP page with an AutoComplete that actually works with the new value added package?

Thanks,

J


I am also havin the same problem.I have uninstalled Atlas,installed the Asp.net Ajax and theJuly CTP .I recreated the project with Autocomplete extender but the webservice method is never being called and there are also no errors.

Guimauve, I would appreciate if u can post a sample code on how you made the extender call the webservice method?

Thanks,

PSK


The javascript errors are pretty annoying. Hopefully it wont be long for beta 2 (or beta 1.1?).:-) It is a shame that the CTP was going so well that it feels like a step backwards but they won't have made these changes for nothing and remember we are rather early adopters! If we shouldn't use beta's for production code then CTP is even more risky :-)

For the AutoCompleteExtender make sure your web service has the ScriptService tag as not having it fails silently. E.G:

[Microsoft.Web.Script.Services.ScriptService]
[WebService(Namespace =http://tempuri.org/)]
[WebServiceBinding(ConformsTo =WsiProfiles.BasicProfile1_1)]


Hi, i have de same Exception (description = "Sys.ArgumentUndefinedException: Value cannot be undefined. Parameter name: element")in WebResource.axd (function Sys$UI$DomElement$getVisible(element)).But my Webservice (or ScriptService) is working fine. I fink the Control is working fine. Everything looks ok, but after Postback (some Applications still need it), pug!Dave
There is a a thread with a sample posted on issue regdin AutoCompleteextenderhttp://forums.asp.net/thread/1437583.aspxIts the same as thx 1137 pointed out

Monday, March 26, 2012

AJAX AutoCompleteExtender does not show a scroll bar

Below is the Web Service that I'm using for the AutoCompleteExtender.

Basically, it runs the SQL SELECT statement to retrieve a list of items in a form of string array depending on the user's input.

Everything works fine, but the AutoCompleteExtender doesn't seem to show a vertical scroll bar.

I set CompletionSetCount = 20, but the list goes as far as the returned list (string array, in this case)

This obviously makes the webpage very, very, very long if user only types in the first character.

Am I missing something here?

Thanks.

Hi,

Please refer to these threads:

http://forums.asp.net/t/1113604.aspx

http://forums.asp.net/t/1126776.aspx

Ajax AutoCompleteExtender causing validators to fire

Hi,

I'm having a problem with validators firing whenever I select an item in a field extended with autocomplete (I guess pressing the enter key is trying to submit the form?). How can I get around this?

Thanks

The autocomplete extender does not stop the enter key event from propagating to the form which causes the validators to kick in. I think we would like to stop that and let the event propagate if an item has been selected. Could you please open a bug on this? Thanks.

Ajax AutoCompleteExtender

Hello!

I have a problem about AjaxAutoComplete.

In my project,I have no error till I put three AutoCompleteExtender.

But when more than 3, I meet "Operation Aborted" MessageBox.

Please help me if you can be quickly.

Thanks

For regards,

Hi,

Without any valuable information, it is hard to say where the problem lies on.

Please provide any more information,eg. any code of this.

Thanks!


Hello!

many many thanks for your reply!

Please forgive me not for reply a once.i find your reply just now.

In my project,there are 3 pages.first page is list page .from this page ,we can go second page to entry data into DB. and then from first page,we can also third page to edit data from DB.

In second page and third page,I used AutoCompleteExtender.

In these pages ,I need to use 5 AutoCompleteExtender .So i used 5.But I found " Operation Aborted" Message when I went more than 3 times these pages .that is ,first I entry,and second time I edit and then third time i entry and up to this time i have no error.but forth time i edit ,In that time Edit Page come on but same time i find "Operation Aborted" MessageBox ,After that,I find "The Page cannot be display".

Some Codes In Pages

<asp:TextBoxid="txt1"runat="server" cssclass="MagicColText"width="30px"maxlength="3"></asp:TextBox>

<ajaxToolkit:AutoCompleteExtenderid="Complete1"CompletionSetCount="10"runat="server"TargetControlID="txt1"ServicePath="WebService.asmx"ServiceMethod="GetCompletion1"MinimumPrefixLength="1"CompletionInterval="1000"EnableCaching="true"></ajaxToolkit:AutoCompleteExtender>

<asp:TextBoxid="txt2"runat="server" cssclass="MagicColText"width="30px"maxlength="3"></asp:TextBox>

<ajaxToolkit:AutoCompleteExtenderid="Complete2"CompletionSetCount="10"runat="server"TargetControlID="txt2"ServicePath="WebService.asmx"ServiceMethod="GetCompletion2"MinimumPrefixLength="1"CompletionInterval="2000"EnableCaching="true"></ajaxToolkit:AutoCompleteExtender>

<asp:TextBoxid="txt3"runat="server" cssclass="MagicColText"width="30px"maxlength="3"></asp:TextBox>

<ajaxToolkit:AutoCompleteExtenderid="Complete3"CompletionSetCount="10"runat="server"TargetControlID="txt3"ServicePath="WebService.asmx"ServiceMethod="GetCompletion3"MinimumPrefixLength="1"CompletionInterval=3000"EnableCaching="true"></ajaxToolkit:AutoCompleteExtender>

and so on....

I used till 5.I don't find error till 3 .

IS there any rules in property of AutoCompleteExtender?

and then i don't understand CompletionInterval!

pls help me!

many thanks!

Best regards,

AJAX AutoCompleteExtender

Hi there everyone.

I have a AutoCompleteExtender working on my site, very nice little feature... But i would liek some information to extend it some.

Now i have another webservice that provides me with a list of Cities in the world. on of these elements may look like this:

<CityList>
<City>
<CityCode>LAX</CityCode>
<CityName>LosAngeles</CityName>
<StateCode>CA</StateCode>
<TravelPort>LosAngelesIntlArpt</TravelPort>
<CountryCode>US</CountryCode>
<CountryName>UnitedStates</CountryName>
</City>
etc

Now currently i am pulling the <CityCode> element and generating a string[] that my web service then sends out to the AutoCompleteExtender.

Couple of things i would like to see happen here and would like some information on:

1) Say my user search for "Los" and LosAngeles shows up in the Entender. They click it. At this point i would like to add LAX as their selected value. Similar to how a DropDownMenu has a SelectedItem.Value and .Text... How do i get this done?

2) i would also like to see the reverse of that and have them still be able to searc h for LAX and LosAngele show up...

There has to be a way to do this right?

Nugs

Hi,

I think this link will help you out :

How to : Use a Key Value Pair in your AutoCompleteExtender ( updated again... )

Thanks

AJAX AutoCompleteExtender

Hi, I'm a newbie to the AJAX tool kit.

I have few basic questions.

1) Is it necessary to have a webservice running to get the data from the data base.. My question is, assume i have a list of Employee names.As soon as i started typing in the Text Field i need to display the Employee name. I have seen a Video session on this. but do we exactly need to run the webservice which has data base conection and retrieval from the database?

2) is it sufficient to have a method to get the data from DB in the .cs file.

Suggest me the Best one.

Tell me a best practise link where i can learn them from basics...

Thanks,

Mythily

Hi Mythily,

No, you have an alternative option, PageMethod. This is a static method defined in the page itself and can be accessed from client side directly.

For example:

// this method is defined in the page itself
[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
public staticstring[] GetCompletionList(string prefixText, int count)
{
string[] words = prefixText.Split(new char[] { ';' });
string[] result = new string[16];
for (int i = 0; i < 16; i++)
{
result[i] = "aaaa";
}
return result;
}

<ajaxToolkit:AutoCompleteExtender CompletionSetCount="4" CompletionListCssClass="completeListStyle" BehaviorID="ace" ID="AutoCompleteExtender1"ServicePath="AutoCompleteExtender.aspx" ServiceMethod="GetCompletionList"runat="server" TargetControlID="TextBox1">

Hope

AJAX autocompleteextender

Hi All,

I am using the autocompleteextender and I am wondering if there is anyone you can click on an option from what it returns to redirect it to another page.

Is this possible?

Thanks

You could use AutoComplete's ItemSelected event in the client and then navigate to another page using JavaScript.

Alternatively, if you have a button that the user usually clicks on to submit the page, you could do the following in the same script:

$get("btnSubmit").click();

This will send a click event to the button and submit your page as normal.

Tim

Ajax AutocompleteExtender

Hi All

I have a query with reference AutoCompleteExtender.

CompletionListCSSClass using Stylesheet named autocomplete_completionListElement which set height of autocomple box 200px. when server return few records, the height does not automatically adjusted.

Is it possible to adjust height automatically?

Kind Regards

Bhavesh

Hi Brvaland,

brvaland:

Is it possible to adjust height automatically?

Do you mean manually adjust the height property?(The Control will automatically control its height property)

If yes , please add this code to your page.

<script type="text/javascript" language="javascript">
function pageLoad(){
$find("myACEBID").add_shown(reAdjustHeight);
}
function reAdjustHeight(){
$get($find("myACEBID")._completionListElementID).style.height = "120px"
}
</script>

Best regards,

Jonathan

Ajax auto complete extender

I am using ajax autocompleteextender. I have declared the service method in the user control itself instead of declaring it in aspx page. But the extender does not work .How can i do it? I want to declare it in ascx page,as i will be reusing the component.

my master page script
=====================
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true" EnablePartialRendering="true"/asp:ScriptManager
my aspx page where i am inheriting masterpage
==============================================

<%@. Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="frmTestAuto.aspx.cs" Inherits="frmTestAuto" Title="Untitled Page" %>
<%@. Register src="http://pics.10026.com/?src=ctlAutoExtender.ascx" TagName="ctlAutoExtender" TagPrefix="uc1" %>
<%@. Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server" /asp:ScriptManagerProxy>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td>TEST AUTO PAGE</td>
</tr>
<tr>
<td>uc1:ctlAutoExtender ID="CtlAutoExtender1" runat="server" /</td>
</tr>
<tr>
<td>Footer</td>
</tr>
</table>
</asp:Content
my ascx page
=============
<%@. Control Language="C#" AutoEventWireup="true" CodeFile="ctlAutoExtender.ascx.cs" Inherits="ctlAutoExtender" %>
<%@. Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server"></asp:ScriptManagerProxy>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td>
<asp:TextBox runat="server" ID="myTextBox" Width="300" />

<ajaxToolkit:AutoCompleteExtender runat="server" ID="autoComplete1" TargetControlID="myTextBox" Enabled="true"
ServiceMethod="GetCompletionList" ServicePath="ctlAutoExtender.ascx.cs" MinimumPrefixLength="3"
CompletionInterval="1000" EnableCaching="true"
CompletionSetCount="12"/>
</td>
</tr>
</table
my ascx.cs page
===============

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Web.Services;
using System.Web.Script.Services;

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ScriptService]

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

}

[WebMethod]
[ScriptMethod]
public static string[] GetCompletionList(string prefixText, int count)
{
string sql = String.Format("select clt_tVLongNm from mclient where clt_tVLongNm like @.companyname + '%'");

List<string> companyList = new List<string>();

using (SqlConnection connection = new SqlConnection("server=192.168.2.57;uid=sa;pwd=d28rg6yp;database=fnocash_report"))

using (SqlCommand command = new SqlCommand(sql, connection))
{
connection.Open();
command.Parameters.AddWithValue("@.companyname", prefixText);
using (SqlDataReader reader = command.ExecuteReader())
{
while (reader.Read())
{
companyList.Add(reader.GetString(0));
}
}
}
return companyList.ToArray();
}
}

please help me out asap


Hi,

In ASP.NET, a request for a .ascx file will be?handled?by?System.Web.HttpForbiddenHandler?HttpHandler,?that's?to?say,?it's?refused.
So you can't use a method in the UserControl, I suggest trying to use a web service(.asmx) to achieve this.
Hope this helps.

Hi,

I am declaring the autocompleteextender in the user control. So, should I give service path for the extender as .asmx file in the extender?

eg:

My ascx page:

<%

@.ControlLanguage="C#"AutoEventWireup="true"CodeFile="ctlAutoExtender.ascx.cs"Inherits="ctlAutoExtender" %>

<%

@.RegisterAssembly="AjaxControlToolkit"Namespace="AjaxControlToolkit"TagPrefix="ajaxToolkit" %>

<

tablecellpadding="0"cellspacing="0"border="0"width="100%"><tr><td><asp:TextBoxrunat="server"ID="myTextBox"Width="300"/>

<ajaxToolkit:AutoCompleteExtenderrunat="server"ID="autoComplete1"TargetControlID="myTextBox"Enabled="true"ServiceMethod="GetCompletionList"ServicePath="App_Code/WebService.cs"MinimumPrefixLength="3"CompletionInterval="1000"EnableCaching="true"CompletionSetCount="12"/></td></tr>

</

table>


Yes,?like?this:??ServicePath="the relative path of the .asmx file"
Thanks, that solved my problem.