O'Reilly logo

Ext.NET Web Application Development by Anup Shah

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

AJAX-based proxies

The same versatility we saw with Store Proxies in Chapter 5, Working with Data, applies to grids too, so that we can load the preceding financial data from an MVC Controller, ASMX Web Service, ASHX handler, and more. The following is an example of ASHX handler:

public void ProcessRequest(HttpContext context)
{
  context.Response.ContentType = "application/json";

  Paging<CompanyData> data = this.GetData();

  context.Response.Write(JSON.Serialize(data));
}

private Paging<CompanyData> GetData()
{
  var data = CompanyData.GetData();

  return new Paging<CompanyData>(data, data.Count);
}

And the following is the only modification needed to the Store to use the handler:

<ext:Store runat="server">
  <Model>
    <!-- as before -->
  </Model>
 <Proxy> <ext:AjaxProxy ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required