0
Hello,
I’m developing an application with ASP . NET MVC and using the Epplus API for XLS export.
In the View of an equipment report I have two @Html.Dropdownlist with Type of Equipment and Status Respectively.
For the display of the report I am working with a Input
of the kind Submit
called Filter, who sends the Id so much of Type how much of Status for consultation in the database through the ActionResult
of the view itself.
How could I use these same two DropDownList
to send, from a Input
Export, the parameters for another Action
of my controller
who will do the same search and return an XLSX?
Follow the snippet of cshtml code:
<div class="ibox-content">
<div class="row">
@using (Html.BeginForm())
{
<div class="col-sm-5 m-b-xs">
@Html.DropDownList("TipoEquipamento", null, htmlAttributes: new { @class = "input-sm form-control input-s-sm inline" })
</div>
<div class="col-sm-5 m-b-xs">
@Html.DropDownList("StatusEquipamento", null, htmlAttributes: new { @class = "input-sm form-control input-s-sm inline" })
</div>
<div class="col-sm-3">
<div class="input-group">
<input type="submit" value="Filtrar" class="btn btn-primary" />
</div>
</div>
}
@using (Html.BeginForm("ExportarDados", "Signv", FormMethod.Get))
{
<div class="col-sm-3">
<div class="input-group">
<input type="submit" value="Exportar" class="btn btn-primary" />
</div>
</div>
}
</div>
Follow my controller’s Actions structure:
[HttpPost]
public ActionResult Index(int TipoEquipamento, int StatusEquipamento)
{
.... Código da Action...
}
public ActionResult ExportarDados(int TipoEquipamento, int StatusEquipamento)
{
.... Código da Action...
}
Gave good! Thanks for the help!!
– Arthur Leite