Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Check this link out</p> <p><a href="http://agilewarrior.wordpress.com/2012/12/13/how-to-simple-html-dropdownlistfor-mvc-net/" rel="nofollow noreferrer">http://agilewarrior.wordpress.com/2012/12/13/how-to-simple-html-dropdownlistfor-mvc-net/</a></p> <p>As you can see, you need to set a parameter to set the selected index. Hope that helps, if not let me know and i'll provide example :)</p> <p>There are also multiple questions already on stackoverflow about this, check this for example: <a href="https://stackoverflow.com/questions/624828/asp-net-mvc-html-dropdownlist-selectedvalue?lq=1">ASP.NET MVC Html.DropDownList SelectedValue</a></p> <p>You could do something like this</p> <pre><code>&lt;%:Html.DropDownList("filterByPageNumber", Model.ResultPerPage, null, new { onchange = "GetResultsPerPage()" }) </code></pre> <p>Your model would then have a property - a list of SelectListItem and you set (server-side) .SelectedItem = true on the SelectListItem that matches the value of your recordsperpage</p> <p>server-side</p> <pre><code>var resultsPerPage = List&lt;SelectListItem&gt;() { new SelectListItem { Text = "10", Value = "10" }, new SelectListItem { Text = "20", Value = "20" }, new SelectListItem { Text = "30", Value = "30" }, new SelectListItem { Text = "40", Value = "40" }, new SelectListItem { Text = "50", Value = "50" }} resultsPerPage.Single(r =&gt; r.Value == recordsperpage).Selected = true; viewModel.ResultPerPage = resultsPerPage; </code></pre> <p>I'm sure you can clean it up, but this provides a simple example that should get you going.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload