.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

contextKey in AutoCompleteExtender

Posted By:      Posted Date: August 24, 2010    Points: 0   Category :ASP.Net

How can I use the contextKey of an AutoCompleteExtender ? 

When I had a search, I got to know that using javascript we can fire the contextkey to the webservice. Could some one help me out in writing this script and how to use it in webservice ????

View Complete Post

More Related Resource Links

Passing Textbox Value to ContextKey in AutoCompleteExtender



I'm trying to use the contextKey in the AJAX AutoComplete tool but there is a problem with regards to passing the contextKey value to the method located in the web service file.

Let me describe how my web form is organised.

There are two textboxes. One of them has the AutoComplete tool. The user enters a word in Textbox1 (which does not have the AutoComplete tool). Afterwards, when he clicks in TextBox2 (which has the AutoComplete tool) and starts to type, the AutoComplete tool will show him the close matches. Now, the items in the AutoComplete menu are retrieved from a SQL database. The Select command (of the AutoComplete which is in the web service file) returns values based on the the value of TextBox1 in the main forum.

This is the client-code of AutoComplete 1:

<cc1:AutoCompleteExtender ID="AutoCompleteExtender1" 

AutoCompleteExtender ContextKey with Session Problem

I have a aspx page with an AutoCompleteExtender and I retrieve users from database.While user log in, I get user's id from database and set to Session["iduser"]. I want to use Session["iduser"] as a contextkey in AutoCompleteExtender. I tried different ways for this but it didn't work...Also I am using a updatepanel.<asp:ScriptManager ID="ScriptManager1" runat="server">    <Services>     <asp:ServiceReference Path="WebService.asmx" />    </Services>    </asp:ScriptManager>my source code:<asp:TextBox ID="txtPost" runat="server"  CssClass="form_text_ozellik"         BackColor="Transparent" BorderStyle="None"></asp:TextBox>     <cc1:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server" TargetControlID="txtPost" ServicePath="WebService.asmx" ServiceMethod="GetUsers"   MinimumPrefixLength="1" CompletionSetCount="12"  DelimiterCharacters="," UseContextKey="true" CompletionInterval="200" EnableCaching="true">    </cc1:AutoCompleteExtender>my web service code:[We

Using Ajax AutoCompleteExtender on dynamic fields



I have quite a problem with a form that contains an autocomplete function. The page is an aspx page with c# codebehind.

On the form there is an address field that the user can type in any string address. This field is using an Ajax autocomplete extender, which suggests roadnames to the user. This works fine.
Furthermore the user has the option to add multiple address fields when clicking a button. This works fine now with Jquery. Jquery copies the table which contains, besides other fields, the address field, and "paste" it underneath the existing adress field.

Problem is, how do I attach the Ajax autocomplete extender to the address fields that gets added? Or is there another workaround to make all these fields have this autocomplete function?

Here is my simplfied code:

aspx page:

<td width="200">
  <asp:TextBox ID="TextBoxStopRoadName" runat="server" Width="200"></asp:TextBox>
      <asp:AutoCompleteExtender runat="server"

Invalid web service call, missing value for parameter: \u0027prefixo\u0027 (AutoCompleteExtender)


Good afternoon.

I'm trying to put an AutoCompleteExtender working, but i'm having an error, that i discovered with Fiddler, that is the reason that the autocomplete doesn't work:

> **{"Message":"Invalid web service call,
> missing value for parameter:
> \u0027prefixo\u0027."**,"StackTrace":"
> at
> System.Web.Script.Services.WebServiceMethodData.CallMethod(Object
> target, IDictionary`2 parameters)\r\n
> at
> System.Web.Script.Services.WebServiceMethodData.CallMethodFromRawParams(Object
> target, IDictionary`2 parameters)\r\n
> at
> System.Web.Script.Services.RestHandler.InvokeMethod(HttpContext
> context, WebServiceMethodData
> methodData, IDictionary`2
> rawParams)\r\n at
> System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext
> context, WebServiceMethodData
> methodData)","ExceptionType":"System.InvalidOperationException"}

This is the webservice code:

    Imports System.Web.Services
    Imports System.Web.Services.Protocols
    Imports System.ComponentModel
    Imports GcpBE750
    Imports ErpBS750
    Imports StdBE750
    ' To allow this Web Service to be called fro

Ajax AutocompleteExtender not working from IIS


I am using  AjaxAutoCompleteExtender  in my asp.net program (C#) . I am applying the extender to a texbox and using internal Web Service. I am getting the desired result, when i am running from the development environment. After Publishing the site to IIS, I am not getting the list and not showing any errors. I have turned off custom errors. My website is not an Ajax Enabled WebSite. So i added the lines into my Web.Config.

I tried all service path.. http://localhost/Test/ WebService.asmx

and i tried ~/Test/WebService.aspx


While testing from the development environment, i am using the last one.

I am not sure whether this is the problem with the service path or any permission issue.



Setting the ContextKey Value with a hiddenfield value

Hi guys,I need to set the ContextKey value of an autocomplete control with the value of a hiddenfield in client side. I did try with <......ContextKey = "hdnLoggedUserID.value"  UseContextKey="true">How can I get the value of the hiddenfield and set it to the ContextKey atribute ?Thanks in advance!

Autocompleteextender problem in google chrome

Hi, I've used autocompleteextender inside a repeater control. On OnClientItemSelected event of autocompleteextender i am setting some hidden field value to use it on server. The code is working fine in all browsers except google chrome. Actually when i traced the code, event is occuring and hidden field is getting value set but the hidden field value is not appearing on the server. On the server i got empty hidden field.  

how to use autocompleteExtender in ASP.net AJAX

In the tutorial for autocomplete text box for static page method in c# the following lines of code is given. When i use it my website using c# it gives error 'invalid term "in" showing in line 7. Why is it so.Plz help me. [System.Web.Services.WebMethodAttribute(), System.Web.Script.Services.ScriptMethodAttribute()]   public static string[] GetCompletionList(string prefixText, int count, string contextKey) {       // Create array of movies       string[] movies = {"Star Wars", "Star Trek", "Superman", "Memento", "Shrek", "Shrek II"};          // Return matching movies       return (from m in movies where m.StartsWith(prefixText,StringComparison.CurrentCultureIgnoreCase) select m).Take(count).ToArray();   } 

AutoCompleteExtender with JSON

 I whant to implement AutoCompletExtender but the problem is that i want in the poput panel to be displayed also other information not only the wordh that he mach. Example: if user type JON then autoCompletExtender call webservice there i return the JSON format of object Customer where i hwe also propertyes like surname age and so on, so in popup panel i wont to show also this information but whene we select then other information like age surname and others will go in properiate TextBox-es.   So the problem how i pare the JSON format in javascript and then display in panel and in wich event i must imlement thet in AutoCompletExtender... Please help me.... Sorry for my bad english.

Limiting records returned by AutoCompleteExtender

Hi all,   I am using AutoCompleteExtender on a text box as follows <cc1:AutoCompleteExtender ID="aacId" runat="server" DelimiterCharacters="" Enabled="True"                        CompletionListCssClass="autocompleteplus_listItem" CompletionListHighlightedItemCssClass="autocompleteplus_highlightedListItem"                        CompletionListItemCssClass="autocompleteplus_listItem" CompletionListElementID="autocompleteplus_completionListElement"                        ServiceMethod="GetCompletionListId" ServicePath=""                         TargetControlID="txtCandidateId" MinimumPrefixLength="2"                         CompletionSetCount="10"> My problem i

AutoCompleteExtender both working and not working

<tr> <td style="width: 35%; text-align: right"> <asp:Label ID="Label2" runat="server" Text="Customer Name"></asp:Label><span style="font-size: 12pt; color: #ff3333">*</span></td> <td style="width: 65%"> <asp:TextBox ID="txtCustName" runat="server" Width="75%"></asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" Font-Size="15pt" ErrorMessage="*" ControlToValidate="txtCustName"></asp:RequiredFieldValidator> <cc1:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server" ServicePath="WebService.asmx" ServiceMethod="FindName" MinimumPrefixLength="1" TargetControlID="txtCustName"> </cc1:AutoCompleteExtender>

AutoCompleteExtender won't show Flyout after it faded out

Hello there,I've got some issues with the AutoCompleteExtender Control and the FadeIn/FadeOut animations.The AutoCompleteExtender works fine, but after the flyout faded out because I entered some characters for which it can't find any results to display, it won't fade in anymore if I remove the last character from the textbox (which was responsible for not finding any results).Example:"This gets a result" --> the flyout faded in-> enter a "x" "This gets a resultx" --> no results found -> flyout fades out-> press backspace"This get a result" --> there are some results (which i can see if i stop the animation by inserting a alert befor the fadin gets executed) but the flyout will not get displayed (faded in). BUT if I wait a few seconds before I remove the last character ("x") it will work fine.-> press backspace again"This get a resul" --> the flyout fades in and the results will be shown.Here is my Code (simplyfied): <asp:Textbox id="tb1" runat="server" AutoCompleteType="Disabled" CssClass="inputtext" type="text" title="Suche" tabindex="1" name="tb1

AJAX AutoCompleteExtender Not Calling WebMethod

I have the correct signature for the web method, and it works fine,  but for some reason it is not being called at all by AutoCompleteExtender<div> <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"> <Services><asp:ServiceReference Path="~/AutoComplete.asmx" /></Services> </asp:ToolkitScriptManager> <asp:TextBox ID="txtUser" runat="server"></asp:TextBox> <asp:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server" TargetControlID="txtUser" ServicePath="~/AutoComplete.asmx" ServiceMethod="GetCompletionList" MinimumPrefixLength="1" EnableCaching="true" UseContextKey="false"> </asp:AutoCompleteExtender> </div>  Imports System.Web.Services Imports System.Web.Services.Protocols Imports System.Web.Script.Services Imports System.ComponentModel Imports System.Data.SqlClient ' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. ' <System.Web.Script.Services.ScriptService()> _ <System.Web.Services.WebService(Namespace:="http://tempuri.org/")> _ <System.Web.Services.WebServiceBinding(ConformsTo:=WsiP

AutoCompleteExtender positioning problems

Hi all, I can't seem to find an answer to this anywhere so I am trying here. When I don't apply any CSS styles to the properties CompletionListCssClass,  CompletionListItemCssClass and CompletionListHighlightedItemCssClass the completion list displays a nice dropdownlist right below the targeted textbox. However, I am simply looking for a border and a scrollbar after 100 pixels in height (I am allowing 20 items returned). Initially I was using the CompletionListElementID property and pointing it to a DIV placed right below the target textbox. I applied the styles to the DIV (height:100px; overflow:scroll;) and all was well. Even though that produced exactly what I wanted, I noticed that VS 2008 SP1 with .NET 3.5 SP1 was telling me that the CompletionListElementID property is obsolete and I should use the CSS styles. So now I am in a bind because I don't know CSS that well and using some example CSS, that doesn't seem to refer to ANY positioning, the list shows up in odd places...nowhere near the target TextBox. Can anyone tell me what I should do? Can I use the CompletionListElementID property even though I am being warned it is obsolete? It seems to work just fine. I know that I downloaded the latest ToolKit for .NET 3.5 and VS2008 SP1. Thanks for any help...

ajaxToolkit:AutoCompleteExtender should filer record based on enrting the text value


Hi All,

I am using ajaxToolkit:AutoCompleteExtender.

<asp:TextBox runat="server" ID="myTextBox" Width="300" autocomplete="off" AutoCompleteType="FirstName" />









Make the AutoCompleteExtender more like the Netflix search textbox


I am using the autocompleteextender control in a project I am working on for a client, but I would like to be able to match words in the middle of the data I am searching. Controls such as the search textbox on sites like Netflix do this. For example, if I go to Netflix and search for 'wolfman' I get results like:

The Wolfman

The Real Wolfman

House of the Wolfman

With the extender I would only get results beginning with 'wolfman'. If my stored procedure in my webservice is written to do search the text as I want, nothing shows in the extender (I'm guessing because so many top results don't begin with the entered text). Is there a way to get the autocompleteextender to behave more like this?


ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend