forum

Home / DeveloperSection / Forums / How to show data in a modal(Popup) using Jquery

How to show data in a modal(Popup) using Jquery

Sachin Singh216330-Mar-2016
Hi Everyone,

I want to display all users in model(Popup) using jQuery.
Here, Below my view page code is:

@{
    ViewBag.Title = "Users";
    <scriptsrc="~/Scripts/jquery-1.8.2.min.js"></script>
    <scriptsrc="~/Scripts/jquery-ui-1.8.24.js"></script>
    <linkhref="~/Content/Site.css"rel="stylesheet"/>
    <linkhref="~/Content/themes/base/jquery.ui.all.css"rel="stylesheet"/>
}
@Html.ActionLink("All Users", "User", "Home", null, new
{
    @class = "openDialog",
    data_dialog_id = "aboutDialog",
    data_dialog_title = "About Us"
})
<divid="aboutDialog">
<h2>Users</h2>
<p>
    //.................... 
</p>
<p><ahref="javascript:void(0);"class="close">Close this Window</a></p>
    </div>
 
<scripttype="text/javascript">
    $.ajaxSetup({ cache: false });
    $(document).ready(function () {
        $(".openDialog").live("click", function (e) {
            e.preventDefault();
            $("<div></div>")
                .addClass("dialog")
                .attr("id", $(this)
                .attr("data-dialog-id"))
                .appendTo("body")
                .dialog({
                    title: $(this).attr("data-dialog-title"),
                    close: function () { $(this).remove(); },
                    modal: true,
                    height: 250,
                    width: 400,
                    left: 0
 
                })
            .load(this.href);
        });
 
        $(".close").live("click", function (e) {
            e.preventDefault();
            $(this).closest(".dialog").dialog("close");
        });
    });
</script>

 

Please Can anyone give me a solution.

Thank you.


Can you answer this question?


Answer

1 Answers

Liked By