1
I installed the package "Install-Package Mvcreportviewer" via Package Manager Console and when trying to create Reportviewer gives an error not found the reference.
My code:
View
@using MvcReportViewer; <-- Aqui dá erro
<h2>Invoice</h2>
@using (Html.BeginForm("Index", "RelatorioInvoice", FormMethod.Post))
{
<div>
<label>
<span>Invoice/Credit note: </span>
@Html.TextBox("Range1", "", new { @class = "form-control form-control-custom", style = "width:100px;" })
<span> até </span>
@Html.TextBox("Range2", "", new { @class = "form-control form-control-custom", style = "width:100px;" })
<span>Série: </span>
@Html.TextBox("txtSerie", "", new { @class = "form-control form-control-custom", style = "width:50px", maxlength = "2" })
<span>Tipo: </span>
@Html.TextBox("Tipo", "", new { @class = "form-control form-control-custom", style = "width:50px;", maxlength = "2" })
<span>CIA: </span>
@Html.DropDownList("ItemsListCIA", null, "Sel...", new { @class = "form-control form-control-custom", style = "width:90px;" })
<input class="btn btn-padrao-bv" type="submit" id="btnPesquisar" value="Pesquisar"/>
@Html.ActionLink("Comentário", "Comentario", null , new { target = "_blank", @class="modal-link" })
</label>
<p>
<label>
@ViewBag.Message
</label>
</p>
</div>
}
<script type="text/javascript">
$(function () {
$('body').on('click', '.modal-link', function (e) {
e.preventDefault();
$(this).attr('data-target', '#modal-container');
$(this).attr('data-toggle', 'modal');
});
$('body').on('click', '.modal-close-btn', function () {
$('#modal-container').modal('hide');
});
$('#modal-container').on('hidden.bs.modal', function () {
$(this).removeData('bs.modal');
});
$('#CancelModal').on('click', function () {
return false;
});
});
</script>
<div style="margin-top: 20px;">
@Html.MvcReportViewer(
"/TestReports/TestReport",
new { Parameter1 = "Hello World!", Parameter2 = DateTime.Now, Parameter3 = 12345, Parameter4 = DateTime.UtcNow },
new { Height = 900, Width = 900, style = "border: none" })
<div id="modal-container" class="modal fade comentario-modal"
tabindex="-1" role="dialog">
</div>
</div>
worked, but when I try to create the "@Html.Mvcreportviewer" as in the example you sent me, it still doesn’t work. I gave Rebuild and it didn’t work.
– AndreeH
What exactly doesn’t work? Gives syntax error? Does code fail to execute? Be more specific.
– Leonel Sanches da Silva
From the error in the View "Mvcreportviewer" Reference, so do not let create the "@Html.Mvcreportviewer" control like the example.
– AndreeH
You can open another question detailing the error, with the specific message?
– Leonel Sanches da Silva
I redid everything here and it worked. Thanks
– AndreeH