pagemethods

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 can use the Json function to return a value, but how do I call the action from the client...

PageMethod Not Updating - Requires Project Rebuild to be Updated

I am using the AJAX Toolkit: <ajaxToolkit:CascadingDropDown ID="CategoryDDL_C" runat="server" TargetControlID="CategoryDDL" Category="Main" PromptText="Please select a category" LoadingText="[Loading...]" ServiceMethod="MainDDL" /> And for the Service Method: [WebMethod] [System.Web.Script.Services.ScriptMet...

Using PageMethods to access MultiiView Control ASP.Net

I have a multiview on my aspx page whose ActiveViewIndex I want to set using javascript. for this I have used UpdatePanel inside which the MultiView control is placed. I have enabled the EnablePageMethods="True" of the ScriptManager. Whenever I am calling the Server Method I am getting "Object reference not set to an Instance of an Obje...

Returning a JSON object from a PageMethod with custom formating

Is it possible to format how an object is returned as JSON from a PageMethod? ie. removing the first "d" element from the data, without writing the JSON from scratch. From { "d": { "name": "bob", "email": "[email protected]" } } To { "name": "bob", email: "[email protected]" } ...

ASP.NET AJAX: How to implement PageMethods feature of the scriptmanager in a user control.

Hi, I am unable to implement PageMethods feature of the scriptmanager in a usercontrol, is a way in which this can be done? ...

Can I pass an array to a .Net Ajax PageMethod?

I am using .Net Ajax PageMethods. I was hoping I could pass a javascript array into my method but I am getting the error: "Type 'System.Array' is not supported for deserialization of an array". Here is a simplified version of what I am doing: Client Side Code: function AddItemsToBatch() { var stuff = new Array(); stuff[0] = "one thin...

ASP.NET Ajax: 'PageMethods is undefined' script error on production server (works on localhost)

In a javascript file I'm calling an ASP.NET Ajax PageMethod (ASP.NET 3.5), correctly defined in the page class a static method using the WebMethod attribute. This works on my development machine, but on the production server the PageMethod object is undefined when my javascript function is called (clicking a button). Some debugging info...

calling an ascx page method using jqery

I know that I can call a page method with jquery using the following syntax $.ajax({ type: "POST", url: "Default.aspx/GetDate", data: "{}", contentType: "application/json; charset=utf-8", dataType: "json", success: function(msg) { // Replace the div's content with the page method's return. $("#Result").text(msg.d); ...

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

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 [ScriptSer...

PageMethod no longer gets called after adding UpdatePanel to a page

I am using asp.net ajax version 1.0 on asp.net 2.0. (I cannot yet upgrade to 3.5) I had a PageMethod that would get called by Javascript. This worked perfectly until I added an UpdatePanel to another part of the page. Now when I run the page with debug turned on The breakpoint in the pagemethod never gets called. when I look in firebug ...

Object definitions not being rendered for ASP.Net Page Methods

I am using ASP.Net Ajax's Page Methods and I have an issue that an enumeration's definition is not being rendered. Here is what I have: public class Contact { public string FirstName{get;set;} public IList<PhoneNumber> PhoneNumbers{get;set;} } public class PhoneNumber { public string Number{get;set;} public PhoneNumberTyp...

Why a PageMethods calling doesn't work?

I have a javascript call to a C# WebMethod. The same page has another call and it is working. I debugged the javascript code, this is called: function userUpdReq_onOk() { ... var clientValidationPassed =Page_ClientValidate(); if( clientValidationPassed ) { PageMethods.RequestUserUpdate(username, email, sex, zipCode, state, city, neighb...

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 client-side, which is my case. I've heard that a solution is to keep the label content in...

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

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 po...

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 represents more of a reusable set of operations and services. Does this sound correct? ...

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 default.aspx page ( www.foo.com/default.aspx) The code will look like this $.ajax({ ...

Pass Array of Javascript objects to PageMethod

Here's the situation: I would like to iterate through a table with input controls, collect up the values and then submit them to an ASP.Net PageMethod to save the data to the database. I have the collection all figured out, but am getting an error that the string can't be converted to a Dictionary. So I end up with something like this b...

ASP.Net Page Method exceptions not bubbling up?

I can't figure out why the exception from a static ASP.Net Page method isn't bubbling up to the Application_Error event to be handled in the global.asax file. I'm not really expecting any errors, but I would like to be safe and know about them if they do happen to occur and would rather not wrap every static method in a try...catch. Doe...

Using PageMethods with jQuery

Simply put I want to call public static methods decorated with WebMethod attribute inside my code-behind C# file from jquery.ajax to get some json and other simple stuff (in different functions). But instead I'm getting whole page :'( I'm not using asp.net AJAX though I'm developing for .NET 3.5 framework and using VS 2008. (There are s...

In ASP.Net can I call a user controls WebMethod using Javascript and PageMethods?

It's saying PageMethods is undefined. ...