Using Thickbox to implement the AJAX update of the call page in asp.net mvc

Source: Internet
Author: User

In the MVC pattern, it is usually the controller process the request and generate the data, selecting a suitable view to display the results to the user. Although ASP.net mvc already has a very rich actionresult to meet the needs of different situations, with the sharp edge of Ajax, we want to have a smoother way of interacting. We want to be able to complete the display of the list in one interface, edit or add it, and complete the refresh. With the help of a jquery extension thickbox we can achieve this effect.

This article is inspired by a blog post: MVC AJAX Form with Ajax.beginform () and JQuery Thickbox (http://geekswithblogs.net/michelotti/archive/ 2009/08/31/mvc-ajax-form-with-ajax.beginform-and-jquery-thickbox.aspx)

And the difference is that in Thickbox, he updates the content in Thickbox instead of loading the Thickbox page (that is, the page behind Thickbox).

I show you the following scenario

Click "New Role" ① to pop up a new role thickbox input window ②, fill in the appropriate information, will use AJAX update role list ③.

Suppose you already know asp.net mvc very well.

Here we do not discuss the model layer in MVC, assuming model data can be obtained through the service layer.

In this case, we need 3 View:rolelist.aspx,rolenamelist.ascx and rolecreate.ascx. The latter two Partialview.

Rolecontroller needs to process the following several requests:

[Get] Rolenamelist (): Displays the role list and returns Rolenamelist.ascx this Partialview.

[Get] Rolecreate (): Displays the input interface of Create Rolecreate.ascx waits for user input related information.

[post] Relecreate: Handles the commit of the Create and returns ROLENAMELIST.ASCX.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.