Questions tagged [pagemethods]

Page Methods are functions in the code-behind file for an ASP.net WebForms page that can be invoked from Web Services or AJAX. They are decorated with the [WebMethod] attribute and marked with the static keyword (Shared in VB.NET).

A Page Method is a function in the code-behind file for an ASP.net WebForms page that can be invoked from Web Services or AJAX. They are somewhat similar to to JsonResult methods in ASP.net MVC.

Page Methods can be easily recognized by the presence of the [WebMethod] attribute and the static keyword (or Shared in VB.NET).

These methods can be used in Web Services or AJAX.

Since these are static / Shared method, they cannot refer to any instance data from the page. In particular, they cannot refer to the controls on the page.

In fact, since an instance of the page only exists during a HTTP request to the page, there is no instance available while the page method is running.

310 questions
6
votes
4 answers

updatepanel vs page methods

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…
Anyname Donotcare
  • 11,113
  • 66
  • 219
  • 392
6
votes
1 answer

PageMethods and UpdatePanel

I have a page hierarchy as the following I want to execute a PageMethod if I click the 'SAVE' button, so I coded like the following On Button Click I called OnClientClick="return btnSaveAS_Clicked()" Called the following on PageLoad of the inner…
Rauf
  • 12,326
  • 20
  • 77
  • 126
6
votes
2 answers

How can we pass multiple parameters to onSuccess method of PageMethod?

I'm calling PageMethod "SameMethod" from javascript method "caller" so that I can get some values from DB. After I get values, control is continuing in "onSuccess" method. Problem is that I need to use some variable values ("importantValue") from…
Janko
  • 93
  • 1
  • 2
  • 10
6
votes
3 answers

How to pass int values to ASP.NET page methods from jQuery?

I am using ASP.NET page methods with jQuery. Here is my code, $.ajax({ type: "POST", url: "Default.aspx/GetRecords", data: "{}", contentType: "application/json; charset=utf-8", dataType: "json", and the ASP.NET page…
ACP
  • 34,682
  • 100
  • 231
  • 371
6
votes
3 answers

window.location change fails AJAX call

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…
Ed James
  • 10,385
  • 16
  • 71
  • 103
5
votes
1 answer

Receiving dynamic object in PageMethod from Javascript

I created a new object() in Javascript, put some values into it and passed it to a PageMethod... var filters = new object(); filters.Name = $("#tbxName").val(); filters.Age = parseInt($("#tbxAge").val()); PageMethods.getPeople(filters,…
everton
  • 7,579
  • 2
  • 29
  • 42
5
votes
2 answers

When to use a page method versus creating a web service?

Our team is trying to figure out some guidelines for using pagemethods vs. creating an actual asmx web service. Seems to me that pagemethods are primarily for one off type calls that are specific to the page, where as asmx are intended are intended…
Rob
  • 3,026
  • 4
  • 30
  • 32
5
votes
2 answers

PageMethods with ASP.Net MVC

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…
tpower
  • 56,100
  • 19
  • 68
  • 100
5
votes
3 answers

ASP.NET AJAX PageMethods call load whole page for .NET 4.5 IIS 7.5

I am calling pageMethod in codebehind of aspx page. I get the response for whole page instead of webMethod response. Also, I tried calling the same webMethod using jquery and got the whole page as response. Client:
gkarch
  • 301
  • 1
  • 4
  • 10
5
votes
7 answers

Content getting swapped for multiple sessions users in asp.net website

I am developing an asp.net website. When two different users are accessing that website with different sessions, one users content is getting swapped to another user. I am using javacsript, calling pagemethods from .aspx pages and C# at code…
Hulk
  • 215
  • 1
  • 5
  • 24
4
votes
4 answers

ASP.NET PageMethods and JQuery AJAX Post – How secure really is it?

I have a following scenario – and what I am really looking is real help from real people. Suggestions / Solutions ? Please. I have an extranet web site for ex. www.foo.com (asp.net 3.5) I am using JQuery 1.3.2 to call ValidateLogin PageMethods in…
bugBurger
  • 6,950
  • 9
  • 32
  • 39
4
votes
4 answers

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

I am performing a jQuery .ajax() call that returns a List 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…
John Rasch
  • 62,489
  • 19
  • 106
  • 139
4
votes
4 answers

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

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…
Cedric Aube
  • 345
  • 4
  • 6
  • 13
4
votes
1 answer

Page Method calls from jQuery to Sharepoint

I have an application page (aspx) deployed in the _LAYOUTS folder of MS SharePoint 2010. I would like to call a method inside that page marked with the [WebMethod] attribute using jQuery. I am using the following code on…
Lorenzo
  • 29,081
  • 49
  • 125
  • 222
4
votes
3 answers

PageMethods is not defined

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…
ria
  • 819
  • 5
  • 19
  • 40
1
2
3
20 21