Я использую FilterTable Саннивокера.Я связываю таблицу фильтров с текстовым полем.При первом переходе на страницу я хочу передать текстовое поле значение из контроллера, но не могу заставить эту часть работать.Текстовое поле заполняется, но оно не начинает фильтровать список.Вот мой код
@model IEnumerable<testSearch.Models.Material>
@{
ViewBag.Title = "Index";
}
<h2>Index</h2>
Filter List:
@Html.TextBox("Search", (string)ViewBag.LastActive)
<table id="MaterialList" class="table">
<tr>
<th>
@Html.DisplayNameFor(model => model.Id)
</th>
<th>
@Html.DisplayNameFor(model => model.Description)
</th>
</tr>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.Id)
</td>
<td>
@Html.DisplayFor(modelItem => item.Description)
</td>
</tr>
}
</table>
@section css {
<style>
.filter-table .quick {
margin-left: 0.5em;
font-size: 0.8em;
text-decoration: none;
}
.fitler-table .quick:hover {
text-decoration: underline;
}
td.alt {
background-color: #ffc;
background-color: rgba(255, 255, 0, 0.2);
}
</style>
}
@section scripts {
<script src="@Url.Content("~/Scripts/filtertable/jquery.filtertable.min.js")" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
$('#MaterialList').filterTable({
inputSelector: '#Search'
});
});
</script>
}
А вот код контроллера:
public ActionResult Index(string lastActive, string nextActive)
{
ViewBag.LastActive = "Material1"; // lastActive;
ViewBag.NextActive = nextActive;
var materals = GetListOfMaterials();
return View(materals);
}
Спасибо за любую помощь.