pagemethods

Pagemethods in asp.net

寵の児 提交于 2019-12-17 07:37:32
问题 My Pagemethod implementation is not working in Chrome browser. I have ASP.NET 3.5 web application developed in VS 2008. The code below not working in chrome or Safari: function FetchDataOnTabChange(ucName) { PageMethods.FetchData(ucName, OnSuccessFetchDataOnTabChange, OnErrorFetchDataOnTabChange); } function OnErrorFetchDataOnTabChange(error) { //Do something } function OnSuccessFetchDataOnTabChange(result) { //Do something } 回答1: This should work in all browsers by following the steps below:

Call ASP.NET PageMethod/WebMethod with jQuery - returns whole page

我的未来我决定 提交于 2019-12-17 04:21:50
问题 jQuery 1.3.2, ASP.NET 2.0. Making an AJAX call to a PageMethod (WebMethod) returns the full/whole page instead of just the response. A breakpoint on the page method shows it's never getting hit. I have the [WebMethod] attribute on my method, and it is public static, returns string and accepts no params. I even tried adding [ScriptService] at the top of my class to see if it helped, but it did not. I have seen this post Jquery AJAX with ASP.NET WebMethod Returning Entire Page which had my same

How To Pass a MultiDimensional Array from Javascript to server using PageMethods in ASP.Net

萝らか妹 提交于 2019-12-13 15:47:12
问题 I have some <li> Items in my HTML Page like this <li id="A1" class="ui-state-default">Item 2</li> <li id="A2" class="ui-state-default">Item 3</li> <li id="A3" class="ui-state-default">Item 4</li> <li id="A4" class="ui-state-default">Item 5</li> I called It using Javascript and Jquery like this to get the Id and Index of the <li> elements function LiOrder() { var order = $('li').map(function (i) { return { id: this.id, index: i }; }).get(); PageMethods.GetServerResponse(order, OnSuccess,

How do you use a return value from the server side (VB.NET) on the client side (JavaScript)?

旧时模样 提交于 2019-12-12 17:20:41
问题 Is it possible to call a function on the server side from the client side using PageMethods , and access that function's return value in JavaScript? Here's an example: Client Side: function onBlur(){ //this function is called when you click away from a textbox PageMethods.SomeServerSideFunction(params, onSuccess, onFailure); } function onSuccess(){ //do something on success //I want to be able to print out the server side function's return value here alert(PageMethods.DoesItWork(params)) /

ASP.NET Best way to retain label.text value between postback with PageMethods

﹥>﹥吖頭↗ 提交于 2019-12-12 11:49:33
问题 ASP.NET 2.0, PageMethods. Good day, I'm using ASP.NET AJAX PageMethods to dynamically change the text of a Label when a dropdownlist is changed on my page. I know that the text of Labels are not retained between postbacks when they are changed on client-side, which is my case. I've heard that a solution is to keep the label content in a hidden field, then to set Label text from that field in Page_Load. However, this solution does not seem really clean to me. Are there any other alternatives

Any way to do a synchronous PageMethods call?

こ雲淡風輕ζ 提交于 2019-12-12 10:55:18
问题 I'm trying to do this: function DelBatch() {var userInfo = get_cookie("UserInfo"); PageMethods.DeleteBatchJSWM(userInfo, function(result) {window.location = "BatchOperations.aspx";}); } But it still runs asynchronously. I need the browser to actually wait until my code-behind is finished executing, then it can be refreshed There's a listbox loaded with values that were just deleted from the database, they shouldn't be visible. Problem I have is the window location refreshes before the code

call page method without script manager from jquery

怎甘沉沦 提交于 2019-12-11 13:26:16
问题 How to call page method from jquery without using scriptmanager 回答1: You can do it this way $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", dataType: "json", url: "webpage.aspx/methodName", data: "{id: '" + id + "'}", success: getTargetSuccess, error: getTargetFailure }); function getTargetSuccess(result,e) { var data = result.d; } function getTargetFailure(result,e) { } 回答2: Excellent guide here: http://encosia.com/2008/05/29/using-jquery-to-directly-call-aspnet-ajax

jquery PageMethod saying the method does not exist

无人久伴 提交于 2019-12-11 02:57:02
问题 i am trying to get a value of this asp.net function : [ScriptMethod, WebMethod] public static bool checkRefresh() { return isChanging; } by calling it in jquery using the PageMethod: var isAllowed = false; $("#edit").click(function () { PageMethods.editFunc(); PageMethods.checkRefresh(DisplayMyResult); //this line gives the error, though it's probably because it's first. }); function DisplayMyResult(ResultString) { isAllowed = ResultString; if (isAllowed == true || isAllowed == "true") {

jQuery Ajax call very slow in IE, but instant in Firefox

一个人想着一个人 提交于 2019-12-10 15:16:39
问题 I am performing a jQuery .ajax() call that returns a List<string> of IP addresses on a specified subnet. I use a [WebMethod] on an .aspx page to return the values. ASP.NET's built-in JSON serializer does the magic to return the actual JSON used in my Javascript. I have profiled the the server-side time, and it takes about 8 msec to populate and return the list, so the server-side code is not the issue. However, when the Ajax call is initiated, in Internet Explorer it can take upwards of 3

How to stop a page refresh in angular 2 within aspx

寵の児 提交于 2019-12-10 09:37:55
问题 The pagemethod works, however when I use the webmethod it refreshes the page destroying the reason to use angular 2 in the first place. How do I prevent the form from refreshing the page? index.aspx <body> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManagerMain" runat="server" EnablePageMethods="true" > </asp:ScriptManager> <my-app>Loading...</my-app> </form> </body> index.aspx.cs [WebMethod] public static string getString() { return "Test"; } app.component.html <div>