Estoy trabajando con ASP MVC, llamo a una vista parcial que debe convertirse en popoup, lo llamo desde un botón desde mi vista index
, el código es el siguiente:
@Model OperacionesCrudMVC.Models.Phone
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 class="modal-title">Phone Detail</h3>
</div>
<div class="modal-body">
<div class="form-horizontal">
<div class="form-group">
@Html.LabelFor(m => Model.Model, new { @class = "control-label col-sm-3" })
<div class="col-sm-9">
@Html.TextBoxFor(m => m.Model, new { @class = "form-control required", @disabled = "disabled" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(m => Model.Company, new { @class = "control-label col-sm-3" })
<div class="col-sm-9">
@Html.TextBoxFor(m => m.Company, new { @class = "form-control required", @disabled = "disabled" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(m => Model.Price, new { @class = "control-label col-sm-3" })
<div class="col-sm-9">
@Html.TextBoxFor(m => m.Price, new { @class = "form-control required", @disabled = "disabled" })
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-warning" data-dismiss="modal">Close</button>
<div id='myModal' class='modal fade in'>
<div class="modal-dialog">
<div class="modal-content">
<div id='myModalContent'></div>
</div>
</div>
</div>
@section scripts{
<script type="text/javascript" src="~/scripts/Appjs/phones.js"></script>
}
</div>
Tengo un .js que me imagino lo hace popup:
$(function () {
$.ajaxSetup({ cache: false });
$("a[data-modal]").on("click", function (e) {
$('#myModalContent').load(this.href, function () {
$('#myModal').modal({
keyboard: true
}, 'show');
bindForm(this);
});
return false;
function bindForm(dialog) {
$('form', dialog).submit(function () {
$('#progress').show();
$.ajax({
url: this.action,
type: this.method,
data: $(this).serialize(),
success: function (result) {
if (result.success) {
$('#myModal').modal('hide');
$('#progress').hide();
location.reload();
} else {
$('#progress').hide();
$('#myModalContent').html(result);
bindForm();
}
}
});
return false;
});
}