Question

this is a typical webMethod i am using as a dataSource for Ajax autoComplete Extender

[System.Web.Script.Services.ScriptMethod()]
[System.Web.Services.WebMethod(EnableSession = true)]

public static List<string> FontNamesList_AutoCompDataSrc(string prefixText)
{ 

    if (SeSn.CurrentSesionVariablsSet.FontList.Count == 0)
    {
        FntsList = ReflectMeths.anyClassFldsAsListByType<fntNamsClss>();

        SeSn.CurrentSesionVariablsSet.FontList = FontsList;
        SeSn.AddToCurrentSesseionVars(App.VariablesNames.FontsList,
            SeSn.CurrentSesionVariablsSet.Fontlist);
    }
    else
    {
        if (SeSn.VarExist(App.VariablesNames.FontsList))
             FontsList= SesnGetValAs.ListStr(App.VariableNames.FontsList);

        else FontsList= SeSn.CurrentSesionVariablsSet.FontList;
    }


    return AutoComplete.FromListStr(prefixText, FontsList);
}

so this method will serve the AutoCompleteExtendr in aspx page.

i would like to find out which one of the ajax AC Extenders was requesting the source, so i could somehow use the same method for more than one control.

if i know who it is, I could switch on its identity and make some other actions ..based on the object that has requested the service .

i hope i am clear with my bad english ...

this is an example of a control on the .aspx file

<cc1:ToolkitScriptManager ID="ToolKitScrptMan1" runat="server"></cc1:ToolkitScriptManager>

<cc1:AutoCompleteExtender ID="AutoCompleteExtender1" TargetControlID="TBX_FntsAC" runat="server"
                         MinimumPrefixLength="1" EnableCaching="true" CompletionSetCount="1"
                         CompletionInterval="100" ServiceMethod="FontNamesList_AutoCompDataSrc" 
                         FirstRowSelected="true" CompletionListCssClass="CL_Css_DataBase" CompletionListItemCssClass="CL_ItemCss_DataBase" CompletionListHighlightedItemCssClass="CL_tHighlightedItemCss_DataBase">
</cc1:AutoCompleteExtender>

so if i have few of them with some different requests

all i need is to know which one of them was fired .

thanks.

Was it helpful?

Solution

Take a look at ContextKey property, which can be used to pass additional information from the webpage to the web method.

The signature of the webmethod will have to be modified to accomodate the ContextKey.
Here - http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/AutoComplete/AutoComplete.aspx

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top