How do I refresh an ASP.NET ListView using jQuery and AJAX?

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!)

Answers


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.


Need Your Help

Changing the position of custom UIButton in custom UITableViewCell

iphone objective-c ios ipad

I need to change the position of UIButton dynamically. I do this in cellForRowAtIndexPath:. I alter the frame of the button in that method. The change is not displayed when the table is initially

Cannot connect to named instance of SQL Server 2008R2

visual-studio-2010 connection sql-server-2008-r2 database-project

I am attempting to create a new Database Project in VS2010 via the New Project Wizard, and via this article: http://msdn.microsoft.com/en-us/library/aa833432(v=vs.100).aspx