In "traditional" ASP.NET (Web Forms), the UpdatePanel control lets you do a partial refresh of a part of a page. You don't need to write much code to hook this up.
What's the equivalent in ASP.NET MVC? I'm guessing I'd need to use a partial view for the bit that I want to update, then on the client side retrieve that 开发者_如何转开发HTML and pump it into the innerHtml of the correct DIV?
A tutorial/example would be helpful...
A quick google with your tags throws up a bunch. This is pretty good:
http://www.iridescence.no/post/Partial-Rendering-with-ASPNET-MVC-and-jQuery.aspx
And yes, you're just calling a controller to return rendered HTML which you then inject. Much lighter than the updatepanel and almost as easy to implement.
Have a look at Superload. I think it's the closest thing to the update panel that I've seen for asp.net mvc. Otherwise you can use jquery ajax, .load() or .get(), to update any parts of the page or divs. You just have to manually set the parameters as needed.
精彩评论