1

is it possible something like this

TextBox1_AutoCompleteExtender.ServiceMethod = "Getlist(" + TextBox1.Text + "," + TextBox1.Text .Length+ ",size_master,size_id,size_name)";

means I want to pass multiple parameter to service.

I saw on internet most post has same copy paste solutions the it suggests to pass argument on key up

my question is if i use set context key then how search parameter will be passed.

Skyblade
  • 2,354
  • 4
  • 25
  • 44
BR BHARDWAJ
  • 399
  • 2
  • 17

2 Answers2

2

No, you can pass multiple parameters to the Web method like that.

Parameters are defined in AutoComplete.js, line 677:

var params = { prefixText: this._currentPrefix, count: this._completionSetCount };

As you can see, Web method signature expects only 2 (or 3, if you use contextKey) parameters.

You can try to pass multiple parameters to the Web method in a few ways:

  1. Change the source code of Ajax Control Tookit in any way you want as long as it is opensource.
  2. Try to bind to existing method, say, _onMethodComplete method.
  3. As a middle between two previous ways you can replace _tickHandler delegate with your own implemetation.
Mikhail Tymchuk
  • 886
  • 4
  • 8
0

On Ajax Control add UseContextKey="true" and ContextKey="PARAMETERS" . If UseContextKey is true your Webservice will receive a third parameter: ContextKey

            <asp:TextBox ID="Name" runat="server" MaxLength="100" Columns="50" />
        <ajaxToolkit:AutoCompleteExtender
            ID="extNombreAutoComplete" runat="server"
            TargetControlID="Name"
            MinimumPrefixLength="3"
            CompletionInterval="500"
            CompletionSetCount="10"
            UseContextKey="true"
            ContextKey="PUT HERE YOUR PARAMETERS"
            ServiceMethod="SearchName"
            ServicePath="~/utils/AutoCompletar.asmx"
            FirstRowSelected="false" />

Your Web service implmentation

        [WebMethod()]
    [System.Web.Script.Services.ScriptMethod()]
    public List<string> SearchName(string prefixText, int count,string contextKey)
    {
        var lista = new List<string>();
        return lista;
    }
Eduardo
  • 78
  • 3