我有一张表,我希望能够通过页面进行搜索。我假设我将不得不使用JQuery来做到这一点。任何人都可以帮助/转发我可以使用的一些有用的教程。我正在使用C#和MVC,所以我也可以使用它。
HTML:
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>
Type
</th>
<th>
Claim Pack Attached
</th>
<th>
Review Period Name
</th>
<th>
Claim No
</th>
<th>
Line
</th>
<th>
Account No
</th>
<th>
Supplier
</th>
<th>
Amount
</th>
@if (Model.ReportData.Select(r => r.ClientID).FirstOrDefault() == 1) {
<th>ASDA Status</th>
}
<th>
Date Sent
</th>
<th>
Days OS
</th>
@if (Model.ReportData.Select(r => r.ClientID).FirstOrDefault() == 1) {
<th>
Nominal Period
</th>
}
else {
<th>
SL Invoice No
</th>
}
<th>
Area
</th>
@if (Model.ReportData.Select(r => r.ClientID).FirstOrDefault() == 1) {
<th>
Debit Ref
</th>
<th>
Debit Date
</th>
}
<th>
Deduct Date
</th>
<th>
Agrred
</th>
<th>
APL Reason
</th>
@if (Model.ReportData.Select(r => r.ClientID).FirstOrDefault() == 1) {
<th>
Dept No
</th>
<th>
Department Name
</th>
}
</tr>
</thead>
@foreach (var i in Model.ReportData) {
<tbody>
<tr>
<td>@i.TypeID</td>
@if (@i.CPAttached != null) {
<td style="text-align:center">
<a title="View Claim Pack" href="@Url.Action("DownloadFile", "Reports", new { i.ClientID, i.CPAttached })">
<span class="glyphicon glyphicon-file" />
</a>
</td>
}
else {
<td> </td>
}
<td>@i.ReviewPeriodName</td>
<td>@i.ClaimID</td>
<td>@i.Line</td>
<td>@i.AccountNo</td>
<td>@i.SupplierName</td>
<td>@String.Format("{0:C0}", i.Amount)</td>
@if (i.ClientID == 1) {
<td>@i.StatusCategoryDesc</td>
}
@if (@i.DateSent == null) {
<td> </td>
}
else {
<td>@i.DateSent.Value.ToShortDateString()</td>
}
<td>@i.DayOS</td>
@if (i.ClientID == 1) {
<td>@i.NominalPeriod</td>
}
else {
<td>@i.SLInvoiceNo</td>
}
<td>@i.Area</td>
@if (i.ClientID == 1) {
<td>@i.DebitRef</td>
if (@i.DebitDate == null) {
<td> </td>
}
else {
<td>@i.DebitDate.Value.ToShortDateString()</td>
}
}
@if (@i.DeductDate == null) {
<td> </td>
}
else {
<td>@i.DeductDate.Value.ToShortDateString()</td>
}
<td>@i.Agreed</td>
<td>@i.APLReason</td>
@if (i.ClientID == 1) {
<td>@i.DeptNo</td>
<td>@i.DeptName</td>
}
</tr>
</tbody>
}
</table>
</div>
答案 0 :(得分:0)
我使用google:
http://devproconnections.com/aspnet-mvc/aspnet-mvc-paging-done-perfectly
http://www.codeguru.com/csharp/.net/net_asp/mvc/implementing-sorting-and-paging-in-asp.net-mvc.html
这是我点击谷歌的前三次点击我会尝试。
答案 1 :(得分:0)
尝试将此插件用于jQuery
https://www.datatables.net/
我总是使用它:))