mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-02-04 05:34:51 +00:00
How to navigate in C#? #246
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Symbai on GitHub (Dec 30, 2018).
How can I load a different view within C#? The documentation and all samples only contain javascript code. The file secondView.cshtml is in the same folder as index.cshtml is.
@robertmuehsig commented on GitHub (Dec 30, 2018):
You boot up a complete ASP.NET Core Application - so you just can "navigate" via typical links or redirects.
When your mainWindow has an open "index.cshtml" just put a link inside it and point to the secondView.html.
The negative point here is, that this will "re-render" the view (just like in a normal web browser)..
Hope this helps!
@Symbai commented on GitHub (Dec 30, 2018):
But I don't want to navigate within the app via buttons or links. Instead within C# from the controller.
@robertmuehsig commented on GitHub (Dec 30, 2018):
Well - you could just redirect the browser to the target view. This would be the "normal" behavior. I'm not sure if there are other options available.
@Symbai commented on GitHub (Dec 31, 2018):
That sounds fine but how would do that? How can I tell the browser to visit secondView.cshtml from C# controller? That's where I'm stuck.
@robertmuehsig commented on GitHub (Dec 31, 2018):
Like this: https://stackoverflow.com/questions/45830460/how-to-redirect-to-a-asp-net-core-razor-page-no-routes
Or just google "ASP.NET Core Redirect"