You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
I'm trying to create links for my page but some of the links rely on what is previously in the querysting.
I get what is in the current querystring like so:
Dictionary<string, string> params = new Dictionary<string, string>();
for (int i = 0; i < Context.Request.Query.Count; i++)
{
params.Add(Context.Request.Query.ElementAt(i).Key, Context.Request.Query.ElementAt(i).Value);
}
When using asp-all-route-data="@params" that seems to generate the link with the current querystring.
and when I do <a asp-all-route-data="@params" asp-route-nextpage="2"> i get a new link with &nextpage=2.
The issue is, doing this actually adds nextpage=2 to params so every link on my page now contains &nextpage=2.
Forexample down in my page I want to have links to change the return size so I'm doing <a asp-all-route-data="@param" asp-route-size="10"> <a asp-all-route-data="@param" asp-route-size="20"> <a asp-all-route-data="@param" asp-route-size="50">
I'm getting a link of href="..&nextpage=2&size=10" href="..&nextpage=2&size=20" href="..&nextpage=2&size=50"
I expected href="..&size=10" href="..&size=20" href="..&size=50"
I didn't expect nextpage to be added to the params list.
How do I get around this issue?
I do not want to manually have to type out each asp-route-param because I'm getting all those in a loop from the querystring I they change all the time based on a gridview filters I want to maintain.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello,
I'm trying to create links for my page but some of the links rely on what is previously in the querysting.
I get what is in the current querystring like so:
When using asp-all-route-data="@params" that seems to generate the link with the current querystring.
and when I do
<a asp-all-route-data="@params" asp-route-nextpage="2">
i get a new link with &nextpage=2.The issue is, doing this actually adds nextpage=2 to params so every link on my page now contains &nextpage=2.
Forexample down in my page I want to have links to change the return size so I'm doing
<a asp-all-route-data="@param" asp-route-size="10"> <a asp-all-route-data="@param" asp-route-size="20"> <a asp-all-route-data="@param" asp-route-size="50">
I'm getting a link of
href="..&nextpage=2&size=10" href="..&nextpage=2&size=20" href="..&nextpage=2&size=50"
I expected
href="..&size=10" href="..&size=20" href="..&size=50"
I didn't expect nextpage to be added to the params list.
How do I get around this issue?
I do not want to manually have to type out each asp-route-param because I'm getting all those in a loop from the querystring I they change all the time based on a gridview filters I want to maintain.
Is this a bug?
Beta Was this translation helpful? Give feedback.
All reactions