Skip to content

Instantly share code, notes, and snippets.

@corespider

corespider/Index.cshtml

Last active Jun 29, 2020
Embed
What would you like to do?
CoreSpider- Export to Excel in ASP .NET MVC
@model IEnumerable<ExportExcel_ASPNETMVC.Models.Customer>
@{
ViewBag.Title = "Index";
}
<h2>Index</h2>
<p>
@Html.ActionLink("Create New", "Create")
</p>
@using (Html.BeginForm("Export", "Customer", FormMethod.Post))
{
<div class="container">
<input type="submit" value="Export to Excel" class="btn btn-primary" />
</div>
<table class="table">
<tr>
<th>
@Html.DisplayNameFor(model => model.CustomerName)
</th>
<th>
@Html.DisplayNameFor(model => model.CustomerAddress)
</th>
<th>
@Html.DisplayNameFor(model => model.CustomerMobile)
</th>
<th></th>
</tr>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.CustomerName)
</td>
<td>
@Html.DisplayFor(modelItem => item.CustomerAddress)
</td>
<td>
@Html.DisplayFor(modelItem => item.CustomerMobile)
</td>
<td>
@Html.ActionLink("Edit", "Edit", new { id = item.CustomerId }) |
@Html.ActionLink("Details", "Details", new { id = item.CustomerId }) |
@Html.ActionLink("Delete", "Delete", new { id = item.CustomerId })
</td>
</tr>
}
</table>
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.