2012-07-19 20 views

回答

3

在你的控制器:

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

相關問題