Do a modal window correctly?

0

I'm learning MVC in aspx, chtml y c# , and I got to the part that shows the details of a student but first I did that I copied the same structure of my Layout and now what I want is to show a modal window of Ver Detalle I know that I have to do a partial view so that I send to call what it shows and pass it to a div, but I do not know very well. How would I have to do anything else?

    
asked by ASpong 14.12.2018 в 00:55
source

1 answer

2

Exactly how you mention it, render the partialview and inject it into the div that is part of the jquery dialog popup

Render Partial View inside jQuery Dialog Modal Popup on Top of Parent View in ASP.Net MVC

Very important as it uses $.ajax which invokes the action that returns the partialview

$.ajax({
    type: "POST",
    url: "/Home/Details",
    data: '{customerId: "' + customerId + '" }',
    contentType: "application/json; charset=utf-8",
    dataType: "html",
    success: function (response) {
        $('#dialog').html(response);
        $('#dialog').dialog('open');
    },
    failure: function (response) {
        alert(response.responseText);
    },
    error: function (response) {
        alert(response.responseText);
    }
});

specifying in the success which is where the render of the view in the div injects

$('#dialog').html(response);
$('#dialog').dialog('open');
    
answered by 14.12.2018 в 01:47