NavigateTo from mainlayout

So I posted a topic on using force reload and how the behavior of handling objects stored in Globals is now being lost. I had to refer back to why I was using force reload in the first place and figured it out. I'm hoping there's perhaps a better way to do this.

So in my application, I have a textbox in the MainLayout that allows a user to enter a filenumber and the application will navigateTo the edit page for that file. The chosen filenumber is entered as a parameter in the url. However if a user is already on the edit page and tries to enter a different filenumber the url is changed, but the page is not reloaded with the new file. So the only way I could get it to change to the newly entered file was to set ForceReload=true. Is there a different way I can do this?

1 Like

If you are loading something in the Page Load event you might need to move your code here:

since Load event is called in OnInitializedAsync:

Or you can execute Load() method of the page.

1 Like

Thanks, this is getting there. Is this event available in .Net 3.1 versions? If not, is there a comparable way I can do this in .Net 3.1?

OnParametersSet is part of the Blazor lifecycle since the first version of the framework:

1 Like

Thanks this is gonna do the trick!