如何使用jQuery和AJAX刷新ASP.NET ListView? [英] How do I refresh an ASP.NET ListView using jQuery and AJAX?
问题描述
(注意:我不想使用UpdatePanel!)
我不知道是否真的可以实现更新ListView没有回发,只是因为ListView控件的底层数据模型。
最好的选择是使用一个完整的AJAX解决方案来使用JavaScript模板引擎。我使用jTemplates和MS AJAX Library v4预览在我的博客上做了一个演示 - http://www.aaron-powell.com/blog.aspx?id=1209
但尽管有相当的信念,您可以使用UpdatePanel并使其有效,我也在这里查看: http ://www.aaron-powell.com/blog.aspx?id = 1195 。使用UpdatePanels时要记住的最大的事情是ViewState。如果您不需要在控件上保存ViewState,请确保已关闭。你可以通过这样做减少你的后期负载。还要清除空格将有所帮助。
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!)
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.
这篇关于如何使用jQuery和AJAX刷新ASP.NET ListView?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!