pagemethods

String exceeds maxJsonLength with less than 250kb

最后都变了- 提交于 2019-12-04 12:32:51
I'm using an entity together with ajax. I want the full table i provice with Entity framework ina grid created with JavaScript. The table I'm currently sending has less than 140 lines. My code works if I only have 50 lines in the table a few more an I get the following error: {"Message":"Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.","StackTrace":" at System.Web.Script.Serialization.JavaScriptSerializer.Serialize(Object obj, StringBuilder output, SerializationFormat

window.location change fails AJAX call

随声附和 提交于 2019-12-04 06:31:54
I've got a click tracking AJAX function (calls a WebMethod on an .aspx page), and I need to call it when the user clicks through to a link. Unfortunately, I'm using window.location = "newUrl" to change the page, which seems to make the AJAX call fail. Is there a way around this? I do not need to get any information back from the AJAX call, I just need to make sure the WebMethod is called. I'm aware that I could just redirect on the success() or failure() calls, but then I would have to wait for the clickTracking() method to run, which takes ~ 1s . That is not acceptable by the agreement in the

Unknown web method. Parameter name: methodName

做~自己de王妃 提交于 2019-12-03 14:44:47
问题 In researching this problem most SO issues were about the static method as a fix. Since it's not working with the real (and a bit sophisticated) WebMethod I've just created a simple one for the sake of checking if reaching the method itself is possible. [WebMethod] [ScriptMethod(UseHttpGet = false)] public static string HelloWorld() { return "Hello World!"; } The call. <script> $(document).ready(function () { $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", url:

Unknown web method. Parameter name: methodName

回眸只為那壹抹淺笑 提交于 2019-12-03 05:29:11
In researching this problem most SO issues were about the static method as a fix. Since it's not working with the real (and a bit sophisticated) WebMethod I've just created a simple one for the sake of checking if reaching the method itself is possible. [WebMethod] [ScriptMethod(UseHttpGet = false)] public static string HelloWorld() { return "Hello World!"; } The call. <script> $(document).ready(function () { $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", url: "usersWebMethods.aspx/HelloWorld", dataType: "json", success: function (data) { alert(data.d); } }); }); <

ASP.net PageMethods return undefined

旧街凉风 提交于 2019-12-02 06:08:45
Hi everyone i trying to get data from cs to js using ToolkitScriptManager. this is my aspx : <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <script src="../assets/lib/jquery/jquery-2.0.3.js" type="text/javascript"></script> <script> $(window).load(function () { alert(PageMethods.isConnected()); }); </script> </head> <body> <form id="form1" runat="server"> <asp:ToolkitScriptManager runat="Server" EnablePageMethods="true" EnablePartialRendering="true" /> <div> </div> </form> </body> </html> and this is my code behind [ScriptMethod, WebMethod] public static bool

PageMethods with ASP.Net MVC

余生长醉 提交于 2019-12-01 18:03:43
问题 I have found ASP.Net PageMethods very handy and easy to use, but I have just started developing using MVC and am not sure how to use them? What is the equivalent of PageMethods.MyFunction() in MVC where MyFunction is a Controller action? I know I can use the Json function to return a value, but how do I call the action from the client? 回答1: I know I can use the Json function to return a value, but how do I call the action from the client? I think you're looking for either getJSON $.getJSON("

PageMethods is not defined

北慕城南 提交于 2019-12-01 05:25:12
问题 I am setting up PageMethods to access server side code using javascript. I am receiving the error "PageMethods is not defined" when i debug using firebug. the server side code is not being fired as well. I have setup my script manager "EnablePageMethods" to true. My method is public & static and it has the WebMethod attribute set up as well. Still i m receiving the above error. Can it be because of the script manager being in a top level master page which has two child master pages and then

Alternate way to use page method inside user control asp.net

六月ゝ 毕业季﹏ 提交于 2019-12-01 04:19:57
问题 Is there a way by which i can achieve functionality of page method inside a user control. Any help is appreciated, Thanks :) 回答1: The easiest way is probably to put the functionality you want in a webservice then use the scriptservice attribute to make that available. Works very similarly to a page method. Quite an extensive example here. <asp:ScriptManager> <Services> <asp:ServiceReference Path="~/MyWs.asmx" /> </Services> </asp:ScriptManager> Then you can call your webmethods in JS:

ASP.Net Ajax - PageMethods Synchronous call and retrieval of results

无人久伴 提交于 2019-12-01 00:26:29
How to ASP.Net Ajax - PageMethods Synchronous call and retrieval of results ? Currently i am doing following async call and working with data : function checkName(name) { PageMethods.IsAvailable(name, onSuccess); } function onSuccess(result, context, method) { //... do something with result .... } How can i do same synchronously with result ? IMHO this is not possible with ASP.NET AJAX because the generated wrappers use async calls. By the way you could use jQuery to call the PageMethod where it is a matter of setting async: false . 来源: https://stackoverflow.com/questions/1957600/asp-net-ajax

ASP.Net Ajax - PageMethods Synchronous call and retrieval of results

北战南征 提交于 2019-11-30 19:10:17
问题 How to ASP.Net Ajax - PageMethods Synchronous call and retrieval of results ? Currently i am doing following async call and working with data : function checkName(name) { PageMethods.IsAvailable(name, onSuccess); } function onSuccess(result, context, method) { //... do something with result .... } How can i do same synchronously with result ? 回答1: IMHO this is not possible with ASP.NET AJAX because the generated wrappers use async calls. By the way you could use jQuery to call the PageMethod