1
嗨..,如何在MVC3 Web Grid中將每個頁面的行數設置爲動態值?
誰能告訴我要在MVC3的WebGrid rowsperpage值分配下拉選擇價值的解決方案。我怎樣才能做到這一點。任何幫助,可以讚賞。
嗨..,如何在MVC3 Web Grid中將每個頁面的行數設置爲動態值?
誰能告訴我要在MVC3的WebGrid rowsperpage值分配下拉選擇價值的解決方案。我怎樣才能做到這一點。任何幫助,可以讚賞。
在你的控制器:
public ActionResult Index(int rowsperpage = 20)
{
// Logic to take and skip whatever
}
在你看來:
@using(Html.BeginForm("Index", "Home"))
{
<select id="rowsperpage" name="rowsperpage">
<option value="10">10</option>
<option selected="selected" value="20">20</option>
<option value="50">50</option>
</select>
<input type="submit" value="Update" />
}
爲了讓你創建下拉列表的HTML幫助的一個更好的想法,見How to fill dropdown list statically in MVC3