Skip to main content
1 of 3

You should pass your AccountListFilterModel to the view, either via model or using ViewBag`ViewData`. Using the latter approach:

In your controller:

public ViewResult Index(AccountListFilterModel accountListFilter)
{
    ViewBag.Filter = accountListFilter;
}

In your view (you can delete the code at the top of the view, that uses Request to get parameters.

<a style="@(ViewBag.Filter.currentSortOrder == "UserName desc" ? "" : "display:none;")" ... />

It's a general rule of thumb that your view should not contain any logic at all, your controller should supply all the data that the view needs.