JavaScript call to page method: error 500. JSON

Posted by Ryan Ternier on Stack Overflow See other posts from Stack Overflow or by Ryan Ternier
Published on 2010-03-22T21:27:38Z Indexed on 2010/03/22 21:31 UTC
Read the original article Hit count: 574

Filed under:
|
|
|
|

I'm using the auto complete control here:http://www.ramirezcobos.com/labs/autocomplete-for-jquery-js/comment-page-2/

And i've modified it as:

        var json_options;
        json_options = {
        script:'ReportSearch.aspx/GetUserList?json=true&limit=6&',
        varname:'input',
        json:true,
        shownoresults:true,
        maxresults:16,
        callback: function (obj) { $('#json_info').html('you have selected: '+obj.id + ' ' + obj.value + ' (' + obj.info + ')'); }
    };

$('#ctl00_contentModule_txtJQuerySearch').autoComplete(json_options);

I have the following method in C# Code behind (aspx.cs)

    [System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
public static string[] GetUserList(string input)
{
    List<string> lUsers = new List<string>();

    Server.DAL.SQLServer2005.User user = new Server.DAL.SQLServer2005.User();
    Server.Info.AuthUser aUser = (Server.Info.AuthUser)HttpContext.Current.Session["AuthUser"];
    List<Server.Info.User.UserDetails> users = user.GetUserList(aUser, input, 16, true);
    users.ForEach(delegate(ReportBeam.Server.Info.User.UserDetails u)
    {
        lUsers.Add("(" + u.UserName + ")" + u.LastName + ", " + u.FirstName);
    });
    return lUsers.ToArray();
}

The error I get back is:

Server Error in '/WebPortal4' Application. Unknown web method GetUserList. Parameter name: methodName

If I change any of the paraemeter names I get an error telling me the paremeter names are not in match. now that everything is as it should, it's bombing.

Any help would rock.

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET