URLParameters preservation for NavigateURL() #5105
Unanswered
markdav-is
asked this question in
Ideas
Replies: 1 comment 1 reply
-
@markdav-is I may not be completely understanding your scenario... but the Event Log feature in Oqtane contains a variety of filters which a user can select in the main view (Index.razor component). When navigating to the Details (Detail.razor component) it needs to retain the state for these filters so that it can restore them when the user returns to the main view. This is done using the following logic in Index.razor which includes a ReturnUrl parameter for the ActionLink component:
And in Details.razor it uses PageState.ReturnUrl (since it was passed above):
And when returning to Index.razor it retrieves the Url parameters:
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Recently, I have been working with URLParameters and have found them advantageous in handling route variables compared to query string parameters. This approach has proven particularly useful when dealing with pages that reflect parent/child relationships and contain modules with multiple actions. However, I have encountered some challenges in navigating back to the parent page after processing an action within a module.
For instance, in developing a resource directory where Providers are the main entities, which have child entities such as Phone Numbers, Addresses, and Services, I can view multiple modules for all these child entities on the provider page. When editing a phone number, instead of using a straightforward EditURL("Edit"), I need to construct a complex URL that rebuilds the URLParameters and provides a ReturnURL. The complexity of this process led me to create an extension method to streamline it.
The primary objective of this implementation is to preserve the URL parameters to launch the action and create a return URL with the same preserved URL parameters. You can disregard the part where I trim the last parameter, as that is specific to my application.
If the NavigateURL() function were "URL parameter aware" and could maintain those parameters, it would eliminate most of the need for deep URL inspection and hydration. While I may not have a comprehensive understanding of this feature request, I thought it important to initiate this discussion.
Beta Was this translation helpful? Give feedback.
All reactions