ahorner
Member
I have a controller action which loads a view. The contents of the view are paginated by a route parameter and some pagination controls. These work fine.
There is a search box which allows you to filter or refilter results. This search box is a form which does a GET to the exact same action. Essentially, the page initial load, pagination, and search box all GET the exact same action.
If I move to any page, let's say 5 for this example, then everything loads fine, but the form URL generated by asp-controller asp-action on the form points to the current action with the page route parameter set (the route parameter is part of the URL, like /Stuff or /Stuff/0 for first page and /Stuff/5 for 5th page)
This means clicking Search to get new results automatically lands on Page 5. How can I correctly clear the previous route parameters? I would very much prefer not having to do asp-route-page="0". There could be many other parameters for filtering introduced later which I do not want to have to explicitly clear.
I would prefer to not have to use Url.Action to generate the target links instead of the tag helper, and I also don't want to use RouteData.Values.Remove as this would clear parameters within the current scope (breaking other forms which still need these parameters)
Thanks
There is a search box which allows you to filter or refilter results. This search box is a form which does a GET to the exact same action. Essentially, the page initial load, pagination, and search box all GET the exact same action.
If I move to any page, let's say 5 for this example, then everything loads fine, but the form URL generated by asp-controller asp-action on the form points to the current action with the page route parameter set (the route parameter is part of the URL, like /Stuff or /Stuff/0 for first page and /Stuff/5 for 5th page)
This means clicking Search to get new results automatically lands on Page 5. How can I correctly clear the previous route parameters? I would very much prefer not having to do asp-route-page="0". There could be many other parameters for filtering introduced later which I do not want to have to explicitly clear.
I would prefer to not have to use Url.Action to generate the target links instead of the tag helper, and I also don't want to use RouteData.Values.Remove as this would clear parameters within the current scope (breaking other forms which still need these parameters)
Thanks