views:

3285

answers:

1

I have a page with a number of ListViews that I want users to be able to sort and page through. Rather than postback and rebind the entire page each time, I would like to do it via jQuery/AJAX selectively for the control in question. I am comfortable making the client-side call to a WebMethod in my page - my question is how do I get the returned data back into the ListView via jQuery?

(Note: I don't want to use an UpdatePanel!)

+2  A: 

I'm not sure if it'll actually be achievable to update a ListView without a postback, just because of the underlying data model of the ListView control.

You're best option to having a complete AJAX solution would be to use a JavaScript templating engine. I've done a demo on my blog using jTemplates and the MS AJAX Library v4 preview - http://www.aaron-powell.com/blog.aspx?id=1209

But despite common belief you can use an UpdatePanel and have it efficient, I also looked at that here: http://www.aaron-powell.com/blog.aspx?id=1195. The biggest thing to keep in mind when using UpdatePanels is ViewState. If you don't need ViewState saved on a control make sure it's turned off. You can really reduce your post-load by doing that. Also removing whitespace will help.

Slace
As I understand them, UpdatePanels postback the entire page and trigger the complete page lifecycle, but only refresh the panel's child controls - which, other than providing a slightly nicer user experience, is basically useless from an efficiency perspective. Or am I missing something?
flesh
They only Postback the ViewState of the entire page allow with the form fields from within the UpdatePanel. True an entire life cycle is triggered on the server though. With careful planning an UpdatePanel can be used and have only a small footprint when used
Slace
I like your templating stuff by the way.. that seems to be the only way I can find that people are suggesting of manipulating data lists
flesh
Well if you want client-side ordering you need to ensure that you don't use .NET controls
Slace