Click here to Skip to main content
11,920,413 members (56,056 online)
Rate this:
Please Sign up or sign in to vote.
See more: MVC3
I am new to MVC3. i gave partial view for edit. I want partial view to modal popup instead of displaying in new page. please give me any idea. please provide some example code.

thanks and regards
Posted 3-Aug-12 6:56am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Here, have a look: load partial view in to a modal popup[^]

Sample, Controller:
public class HomeController : Controller
    public ActionResult Index()
        return View();
    public ActionResult Modal()
        return PartialView();
then a Modal.cshtml partial that will contain the partial markup that you want to display in the modal:
<div>This is the partial view</div>
and an Index.cshtml view containing the button which will show the partial into a modal when clicked:
<script src="@Url.Content("~/Scripts/jquery-ui-1.8.11.js")" type="text/javascript"></script>
<script type="text/javascript">
    $(function () {
        $('.modal').click(function () {
            $('<div />').appendTo('body').dialog({
                close: function (event, ui) {
                modal: true
            }).load(this.href, {});
            return false;            
@Html.ActionLink("show modal", "modal", null, new { @class = "modal" })


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 415
1 phil.o 170
2 Dave Kreskowiak 155
4 F-ES Sitecore 130
0 OriginalGriff 6,778
1 KrunalRohit 4,495
2 Sergey Alexandrovich Kryukov 3,203
3 George Jonsson 2,805
4 Suvendu Shekhar Giri 2,181

Advertise | Privacy | Mobile
Web03 | 2.8.151120.1 | Last Updated 3 Aug 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100