ASP.NET MVC is the ideal foundation for such needs. What would I do if I were at your disposal is to work with the jQuery Ajax API.
The following blog post should give you a hint about what you can do with PartialViews, JQuery and Ajax calls to the server:
http://www.tugberkugurlu.com/archive/working-with-jquery-ajax-api-on-asp-net-mvc-3-0-power-of-json-jquery-and-asp-net-mvc- partial-views
UPDATE
It was proposed to introduce a brief introduction, so here it is.
The following code is your action method:
[HttpPost] public ActionResult toogleIsDone(int itemId) {
RenderPartialViewToString is an extension method for the controller. You need to use Nuget here to bring down a very small package called TugberkUg.MVC , which will have a controller extension for us to convert partial views for a string inside the controller.
The following is a summary of how you can invoke it using jQuery:
var itemId = element.attr("data-tododb-itemid"); var d = "itemId=" + itemId; var actionURL = '@Url.Action("toogleIsDone", "ToDo")'; $("#ajax-progress-dialog").dialog("open"); $.ajax({ type: "POST", url: actionURL, data: d, success: function (r) { $("#to-do-db-list-container").html(r.data); }, complete: function () { $("#ajax-progress-dialog").dialog("close"); $(".isDone").bind("click", function (event) { toggleIsDone(event, $(this)); }); }, error: function (req, status, error) {
Some additional steps should be taken. So, check out the blog post for a complete walkthrough.
source share