In my solution, I have a button that opens a query modalview. After the query, I need to return the result of the records in the form of a link. When clicking on the link, I should return the query result to the main screen, but rather changing and directing the fields to one or more that receive the same reference. I'm having two problems: The first is that I'm not able to return the result of the query in the PartialView Modal, and the second when I send the query return, it enters the JavaScript method that redirects the fields. can anybody help me? Here is the summary code: Notes record view:
View of notes
@Html.EditorFor(model => model.NOTA_NOM_DEV, new { htmlAttributes = new { @class = "form-control", value = "", size = "45", maxlength = "45", type = "hidden" } })
@Html.ActionLink("Fornecedor", "_ConPessoas", "Pessoas", new { id = 4 }, new { @class = "modal-link btn btn-default" , id = '4'})
<script type="text/javascript">
$(function () {
// Initialize numeric spinner input boxes
//$(".numeric-spinner").spinedit();
// Initalize modal dialog
// attach modal-container bootstrap attributes to links with .modal-link class.
// when a link is clicked with these attributes, bootstrap will display the href content in a modal dialog.
$('body').on('click', '.modal-link', function (e) {
e.preventDefault();
$(this).attr('data-target', '#modal-container');
$(this).attr('data-toggle', 'modal');
});
// Attach listener to .modal-close-btn's so that when the button is pressed the modal dialog disappears
$('body').on('click', '.modal-close-btn', function () {
$('#modal-container').modal('hide');
});
//clear modal cache, so that new content can be loaded
$('#modal-container').on('hidden.bs.modal', function () {
$(this).removeData('bs.modal');
});
$('#CancelModal').on('click', function () {
return false;
});
});
</script>
_Partial view de Consulta
@{ Layout = null; } @using PagedList.Mvc; @*@using SisCerinfo.Models;*@ @using (Html.BeginForm("_ConPessoas", "Notas", FormMethod.Get)) {
Pesquisa de Pessoas
CPF/CNPJ: @*@Html.EditorFor(model => model.PES_DOCID, new { htmlAttributes = new { @class = "form-control", maxlength = "14", size = "14" } })*@ ou Nome: @*@Html.EditorFor(model => model.PES_NM, new { htmlAttributes = new { @class = "form-control", maxlength = "50", size = "50" } })*@
@*@Html.ActionLink("Devedor ", "ViewConPes", "Notas", null, new { @class = "modal-link btn btn-success" })*@
@{ if (Model != null) { foreach (var item in Model) { @item.PES_NM @Html.ActionLink("Enviar", "CadNotas", null, new { onclick = String.Format("informa_pessoa({0}, '{1}', '{2}'", @item.PES_ID,'0','0')}) } } } } $(function () { $('#approve-btn').click(function () { $('#modal-container').modal('hide'); }); }); function informa_pessoa(pesid, sus_lim, sus_dt) { //var pessoa = document.forms[0].id var pessoa = HttpContext.Current.Request.RequestContext.RouteData.Values["id"].ToString() //var pessoa = document.frm.TipoPesquisa.value; //var pessoa = document.frm.TipoPesquisa.value; if (pessoa == 4) { window.opener.document.frm.NOTA_NOM_DEV.value = trim(pesnm); window.opener.document.frm.NOTA_LIM.value = trim(sus_lim); window.opener.document.frm.NOTA_DT.value = trim(sus_dt); } window.close(); }