开发者

JavaScript call to page method: error 500. JSON

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.v开发者_Python百科alue + ' (' + 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.


If your code is in a user control, (and not in the actual aspx), that might cause problems. I guess it shouldn't, but I've had problems with it myself, don't remember exactly how they looked, but in the end I retorted to placing my web methods in asmx files instead of aspx files, if they are to be reached from anything but the aspx itself, and it's been working out great =)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜