Last post May 07, 2020 09:41 AM by Rena Ni
May 06, 2020 11:11 PM|BitShift|LINK
Correct me if Im wrong, but since Razor Pages and their handler methods generally return a viewmodel, the whole page needs to refresh to handle this. So there are different ways of setting up a razor page, much like there are with a MVC application. Some
of them are
- Handler methods. Each method returns a model
- Named handler methods. Each handler method is referenced via seperate form tag from within the razor page
- Partial pages
- Partial pages with Ajax, which lets you update sections of a page without refreshing the whole page
- Using a separate web api combined with jQuery to fetch data and update sections of a page.
That about sum it up? Please correct where Im wrong.
May 06, 2020 11:16 PM|mgebhard|LINK
Razor Pages are a server side UI framework. If your intention is client side UI rendering then Razor Pages is not a good option. It can work but not the best tool for the job.
May 06, 2020 11:41 PM|BitShift|LINK
As of now, the approach/architecture Im using involves using
- Telerik asp.net core library for UI components
- Razor pages which references model classes defined in a separate library of the solution
- Web api that recieves/returns models of the same classes in the library that the razor pages references
- After the initial page loads, any additional data fetching/updates are done via jQuery and AJAX calls to the web api
It seems to work pretty well so far. The benefits I see are:
- No dependency on npm
- Simple project structure
- Model classes defined once and reused in both the page as well as the api
May 07, 2020 09:41 AM|Rena Ni|LINK
Handler methods. Each method returns a model
Razor pages work as one so you do not have to return the Model. You just bind it and you have access inside the page.
And the other content you said seems to be quite well.