Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

A pro alternative to microsoft AJAX Update panel?

Tags:

c#

ajax

asp.net

as you all know update panel send the same response to server as a full post back ( or maybe i am understanding wrong), it is true that it is much better than a full post back.

so is there an alternative to send only response data ? like you have a method that ill return date, i think this is the only thing that should be sent and not the whole control view state that is going to show it ( again maybe i understood it wrong).

i am using Telerik AJAX controls, and they are built upon Microsoft AJAX so there is not much of improvement there.

one approach i like is http://www.coolite.com/ they have AJAX Methods and events, which i think is what i am looking for, but the project is moving slowly and does not have flexibilities for my requirements.

so any input is highly appreciated.

like image 690
DevMania Avatar asked Apr 28 '09 16:04

DevMania


2 Answers

If you want more control, one technique is to use JQuery and AJAX Client Library for ADO.NET Data Services to bind JSON data on the client side.

Check this sample here. This is a good example of JQuery complementing ASP.Net AJAX.

First, I'm retrieving data from SQL Server and I need it in JSON format. I'm using the AJAX Client Library for ADO.NET Data Services to make a REST (GET) query to the back-end. To start with I'll just get the data...I include "datatable.js" as a client-side script and use Sys.Data.DataService() to make an async query. In JavaScript you can tell it's a Microsoft type if it's got "Sys." front of it. All the client support for ADO.NET Data Services is in datatable.js.

like image 79
Gulzar Nazim Avatar answered Sep 23 '22 04:09

Gulzar Nazim


This is why I encourage programmers new to AJAX to learn the basics before adopting a library - when you understand what's actually happening, this sort of optimization becomes obvious.

so is there an alternative to send only response data? Like, you have a method that will return only a date?

Yes. The most basic way is to just write the date string to the response stream and end the response before anything else is sent - HTTP Handlers (ashx) work great for this. For a more ASP.NET AJAX-friendly technique, check out Web Methods.

like image 32
Shog9 Avatar answered Sep 23 '22 04:09

Shog9