View Full Version : Ext.ux.AspNetAjaxProxy

8 May 2008, 2:07 PM
Here's a proxy I use to connect to ASP.NET Ajax web services that are generated by the ASP.NET script manager.


Ext.ux.AspNetAjaxProxy = function(config)
Ext.apply(this, config);

Ext.extend(Ext.ux.AspNetAjaxProxy, Ext.data.DataProxy,
load : function (params, reader, callback, scope, args)
this.reader = reader || this.reader;
this.callback = callback || this.callback;
this.scope = scope || this.scope;
this.args = args || this.args;

// Just apply the passed in params to the defaults to make sure we have
// all the params that .NET is expecting.
params = Ext.apply(this.methodParams, params);

//Convert the params into an array of values so that they can be used in the call
//(note assumes that the properties on the object are in the correct order)
var paramList = [];
for (var property in params)

//Add the callback and error handlers

//Make the actual ASP.Net web service call
this.proxyMethod.apply(this.proxyObject, paramList);

loadResponse : function (response)
this.callback.call(this.scope, this.reader.readRecords(response), this.args, true);
It allows you do to use the javascript proxy that .NET script manager creates for your web services in .NET. I use it like this:

var store = new Ext.data.Store({
proxy: new Ext.ux.AspNetAjaxProxy(
proxyObject: namespace_name.object_name,
proxyMethod: namespace_name.object_name.function_name,
methodParams: {start:0, limit:20, filter: "", sort:"", dir:"", fields:[]},
errorHandler: Ext.util.errorHandler
reader: new Ext.data.JsonReader(
root: 'rows',
totalProperty: 'totalCount',
id: 'PrimKey'
remoteSort: true

6 Oct 2008, 7:59 AM
Hey Keith,

trying to figure out this error - it doesn't like the code regardless and I can't figure out why it's doing it.

A Runtime Error has occurred.
Do you wish to Debug?

Line: 4770
Error: Sys.ArgumentTypeException: Object of type 'Array' cannot be converted to type 'Function'.
Parameter name: onSuccess
Yes No

Don't know if you're willing to help or not /:)