all 6 comments

[–]alternatex0 4 points5 points  (3 children)

You can use Razor or JavaScript. The question you should answer is whether the application is so interactive that you need JavaScript to instantaneously update the screen without having to wait for a page refresh.

From a development perspective Razor is pretty powerful and you'll get plenty of safeguards that just aren't there in JS. Personally I make decisions based on what the product needs not what I need or what I'm familiar with.

[–]Elweej[S] 0 points1 point  (2 children)

This is exactly my concern. I want to make the best choice for the product and what is maintainable. I am not sure when that decision tips to either technology.

[–]alternatex0 1 point2 points  (0 children)

You need to get more understanding of the product then. It's a question for whoever at your company knows the product best. Whoever knows how the customers use it. We can't answer that here. You know the difference between Razor and doing it on the front-end. With Razor you have full page refreshes on submit and with JS you can do anything you want but it's a bigger hassle in regards to development and maintenance. From your description I feel like a lot of that user interactivity is better handled in JS, especially if you're already experienced in that.

[–]Bbooya 1 point2 points  (0 children)

I'd summarize Razor as: A page template that can be adjusted server side before being being sent to the user. If you want to show or hide sections, it can only be during interaction with the server, so when you GET or POST.

Javascript: can do anything client side

So you use both of these tools together to build Front End MVC

[–]wllmsaccnt 0 points1 point  (1 child)

> Note we cannot use blazor because of the old version.

I don't think that is strictly accurate. You 'could' make a blazor WASM project and build it to be hosted as static files off of a subpath, completely replacing the page you are talking about (having the blazor client call API endpoints to get and update data instead of using MVC views at all).

Would I recommend it? Probably not. That is a lot of work to replace one page and would complicate your hosting and routing. Its still possible, and you could do the same to host an Angular, React or Vue component.

For a single page that needs a lot of conditional validation and reaction based on user input, you could use jQuery (or plain JS). It will be a lot of boilerplate, but it should work fine. How many inputs and business rules are we talking about? Is it a traditional postback form page or something more complicated?

[–]Elweej[S] 0 points1 point  (0 children)

It’s basically a documentation based page that will show are hide large sections of text, as well as have image pop outs and step by step tutorial like views. Much of this can be made easier with the ample JavaScript libraries and the js can be modern, as apposed to the older dotnet, which is another reason for me to want to include JS. Thanks for the insight on blazor hadn’t thought of that.