我是MVC的新手。不确定如何在点击提交按钮时不让页面完全闪烁刷新。除了将代码放在我的控制器中的操作中之外,还没有找到示例,我更愿意拥有下面的代码。谢谢你的帮助!
<form method="post">
<div style="float: left">
Enter the number of days previous to today for which to search: <input type="text" name="NumberOfDays" value="@Request.Form["numberOfDays"]"/>
</div>
<div class="puck-button">
<input type="submit" value="GO!" class="btn btn-primary"/>
</div>
<br/><br/><br/><br/>
@{
var numberOfDays = int.Parse(Request.Form["NumberOfDays"].IsNullOrWhiteSpace() ? "0" : Request.Form["NumberOfDays"]);
var startDate = DateTime.Today.AddDays(-numberOfDays);
<table id="puckBoard" class="gridView">
<thead>
<tr>
@foreach (var item in Model.ProcessSteps)
{
<th>
<div class="puck-step">
@Html.DisplayFor(modelItem => item.Description)
</div>
</th>
}
</tr>
</thead>
<tbody>
@if(startDate != DateTime.Today) { @CompactTableRows(startDate, Model.Modules) }
else
{ @GetSimpleModuleTableRow(Model.Modules) }
</tbody>
</table>
}
</form>