MVC C# popup window is not popping

lulu50
lulu50 used Ask the Experts™
Hi,
When I click on my link, it takes me to a whole new page instead of opening my partial view page in a popup window.
I’m not sure what I’m doing wrong can you please take a look and let me know
Thanks,


Controller: 
      public ActionResult RulePartialView()
        {
            CABRRulePartialViewModel model = new CABRRulePartialViewModel();

            return PartialView(model);
        }

Open in new window


Index page: 

    $(document).ready(function () {
$(function () {
            $('#dialog').dialog({
                autoOpen: false,
                width: 400,
                height:500,
                resizable: false,
                title: 'Product',
                modal: true,
                open: function(event, ui) {
                    $(this).load("@Url.Action("RulePartialView", "CareAdvanceBusinessRules")");
                },
                buttons: {
                    "Close": function () {
                        $(this).dialog("close");
                    }
                }
            });
            $("#opener").click(function () {
                $("#dialog").dialog("open");
            });
        });

  });


    <div id="dialog" title="Basic dialog"> </div>

    <a id="opener" href="@Url.Action("RulePartialView", "CareAdvanceBusinessRules")">Click to open popup window </a>

Open in new window


Partial view page 

@model BCUW.Model.CABusinessRules.CABRRulePartialViewModel

<p>hello this is the partial view page</p>

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Multitechnician
Top Expert 2014
replace :
            $("#opener").click(function () {
                $("#dialog").dialog("open");
            });

Open in new window

by :
            $("#opener").click(function (event) {
                event.preventDefault(); // https://api.jquery.com/event.preventdefault/
                $("#dialog").dialog("open");
            });

Open in new window

Author

Commented:
leakim971

I thank you so much for helping me with this.

It finally works and I can see my dialog box Thank you so much

you're the best!!!!!!!
leakim971Multitechnician
Top Expert 2014
you welcome

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial