official alternative to ajax

C

codefragment

Hi

I have asked this on the official asp.net forums but no luck so
thought I'd try here

Assume you have a page with a filter control and a grid view and many
other controls on it. When the filter changes you want the gridview to
change but nothing else. In particular all you would like to happen is
for an ajax call to occur and a new grid view to be returned.

Similarily you might have a treeview working asynchronously, you might
have an n'tiered arrangment and if the database disappears you would
want a different control on the page to indicate this, but the treeview
can't be connected to other controls in this manner (can it?)

That kind of situation is possible with Raw html and Ajax. Obviously
ajax calls are easy enough (especially using something like AjaxPro)
and to get the a table back you could just create it and return it.
Similiarly for the treeview example you could return an li/ul structure
normally plus a different control to indicate the error.

So, my question. What is the official way to do things like this. I
suspect the answer is use a postback

ta

(sig: findbyfoldface)
 
C

Cowboy \(Gregory A. Beamer\)

I see a lot of people trying to avoid postback, as they feel painting the
page over again is somehow inferior to doing some voodoo in the back with
Ajax. And, in some cases, they are correct. In others, they are creating two
data transports that they have to maintain, simply to avoid a repaint. I do
not see this as a wise use of Ajax, but everyone has their own opinion.

You can talk to controls all day long on the client side and even wire them
to Ajax calls. If you like, you can code your own via the XMLHTTP and with
SOAP even make true web service calls from the client. As long as you emit
the client script from your code beside (behind?) page, you can get the name
of the control, no matter where it is placed, and you can then have one
control pounding on another without a complete postback.

The question is whether you want to maintain this architecture.

PROS
1. It does not completely repaint the page

CONS
1. Harder to debug a mix of client and server script
2. Less maintainable

The main benefit of Ajax (yes, I realize there are many other reasons to use
it ;->) is user accessibility. For example, the google toolbar approach
where a drop down is created on the fly or the ability to change states
based on a country, or fill in a list of cities based on a postal code.
These are very valid reasons to use an asyncrhronous transport. I do not, in
general, believe that gathering a full spreadsheet of data is the best use
for asynch (although there are certainly some specific examples when it
would be wise).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,140
Latest member
SweetcalmCBDreview
Top