M
M
MaxSurm2015-11-07 14:24:34
ASP.NET
MaxSurm, 2015-11-07 14:24:34

Modal window in MVC 5 and Bootstrap?

Good afternoon! such a problem, I need to fix it so that a modal window opens, I'm not familiar with mvc, so I'm poking around. A friend made a modal using Jquery, but it should be on bootstrap.

@Html.ActionLink("Создать новую", "Create", new { }, new { @class = "btn btn-default viewDialog", data_dialog_title = "Создание модели" } )

<!-- modal placeholder-->
<div id='myModal' class='modal fade in'>
    <div class="modal-dialog">
        <div class="modal-content">
            <div id='myModalContent'></div>
        </div>
    </div>
</div>

$(function () {

        $.ajaxSetup({ cache: false });

        $("a[data-modal]").on("click", function (e) {

            $('#myModalContent').load(this.href, function () {


                $('#myModal').modal({
                    /*backdrop: 'static',*/
                    keyboard: true
                }, 'show');

            });

            return false;
        });
    });

I add with the link data-toggle="modal"
It doesn't work.
tell me how to do it :)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Evgeny Perin, 2015-11-07
@seoperin

Have you looked at the bootstrap site ?

D
Dmitry Gormash, 2015-11-07
@kanonir1886

There is a modal window on the bootstrap site.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question