pagemethods

PageMethods, jQuery and JSON

旧时模样 提交于 2020-01-06 05:00:19
问题 I am trying to call a PageMethod using jQuery like this: [WebMethod] public stataic string WebMethod(PostData data) { //DO WORK return "a"; } PostData class is as follows: public class PostData { public string Guid{get;set;} public string Action{get;set;} public string Id{get;set;} } I'm calling method from jQuery like this: $.ajax({ type="POST", url: 'url', data: JSON.stringify(b), contentType: "application/json;charset=utf-8", dataType: "json", success: function (msg) { var t = $(c).html();

Calling asp.net page method from javascript not working

↘锁芯ラ 提交于 2019-12-29 08:32:23
问题 Hi I am calling a simple page method from javascript , here is my code at markup function OnCallSumComplete(result, userContext, methodName) { alert(result); } function OnCallSumError(error, userContext, methodName) { if (error !== null) { alert(error.get_message()); } } function test(){ var contextArray = ""; PageMethods.TestMethod("test parameter", OnCallSumComplete, OnCallSumError, contextArray); } <asp:ScriptManager ID="ScriptManager1" EnablePageMethods="true" runat="server" /> at cs

Calling asp.net page method from javascript not working

♀尐吖头ヾ 提交于 2019-12-29 08:32:12
问题 Hi I am calling a simple page method from javascript , here is my code at markup function OnCallSumComplete(result, userContext, methodName) { alert(result); } function OnCallSumError(error, userContext, methodName) { if (error !== null) { alert(error.get_message()); } } function test(){ var contextArray = ""; PageMethods.TestMethod("test parameter", OnCallSumComplete, OnCallSumError, contextArray); } <asp:ScriptManager ID="ScriptManager1" EnablePageMethods="true" runat="server" /> at cs

updatepanel vs page methods

孤街浪徒 提交于 2019-12-29 04:24:08
问题 I use update panels all the time when i wanna to update specific part of my page but recently i face performance problems ( i mean it 's slow in rendering the intended control and sometimes it doesn't work and need multiple click to work !! so my question is : Is the page method could be considered as an efficient alternative to the update panel and do the ajax magic ? What are the other alternatives? please if possible a simple example to clarify how to replace the update panel using with

How to get control values and modify them in Page Methods?

☆樱花仙子☆ 提交于 2019-12-25 19:04:18
问题 I have couple of controls in the page. I need to modify these value in Page method. How can I do that?. When I modify those values in page method should reflect in page? Please give me expample. 回答1: Quick example: <asp:ScriptManager runat="server" EnablePageMethods="true" /> <!-- or ToolkitScriptManager, but remember to put only one --> <script type="text/javascript"> function invokeMethod() { x = document.getElementById('<%= TextBox1.ClientID %>').value; PageMethods.theMethod(x, OnSuccess,

.NET Page Method vs UpdatePanel, Which is Better for Updating and Refreshing

旧街凉风 提交于 2019-12-24 11:37:59
问题 I haven't started writing any code for this program, but here's what I need to do in C#/ASP.NET, both of which I'm just starting to learn. I have a DIV on a page that I want to update with information from an MS SQL Server every five seconds. Would it be better to create my countdown timer on the JavaScript or C# side? Would UpdatePanel or creating a Page Method be more efficient for updating the DIV with the database information? Load times are a serious issue for this application, so the

Uploading big Files

流过昼夜 提交于 2019-12-23 20:51:09
问题 I am an amateur ASP.net developer working on my first job (a friends website). ASP.net v4.0, using VS2010. His company makes 3D models (using a 3D printer). The website is currently in development but can be found here. I would be the first to admit that the code has been a bit rushed and hacked in, but my friend is quite happy with what he has so far. One of the requirements is that his customers need to be able to upload their model design files, which could be up to 100 MB each (or maybe

ASP.net PageMethods return undefined

走远了吗. 提交于 2019-12-20 05:17:27
问题 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>

Calling a Page Method when the Browser Closes

我的未来我决定 提交于 2019-12-19 12:21:53
问题 Hi here I'm trying to call a [webmethod] on bodyunload method. But it is getting fired on page load itself only. How do i prevent it? Here's the code I am using: [WebMethod] public static void AbandonSession() { HttpContext.Current.Session.Abandon(); } <script language="javascript" type="text/javascript"> //<![CDATA[ function HandleClose() { PageMethods.AbandonSession(); } //]]> </script> <body onunload="HandleClose()"> .... .... .... </body> Thank you, Nagu 回答1: I have tested with below code

WebMethod vs ScriptMethod

家住魔仙堡 提交于 2019-12-17 15:29:36
问题 I have a .NET 3.5 aspx place with a method marked with the [WebMethod] attribute. I'm calling this with jQuery, sending JSON in both directions. This all works great. My question is, what does [ScriptMethod] do when applied to an method? I've tried this and it seems to yield the same result. Are ScriptMethod and WebMethod identical and interchangeable, or does one provide functionality and/or overhead that the other doesn't? In general, I find myself confused with all of the options available