AARGH!!! I have been driving myself crazy! I am new to Razor Pages and am migrating a large application that extensively used nested ascx pages where a nested page would call a second nested page while passing objects forward. I can see no way of getting OnGet() on a nested view or Razor Page to be called, nor can I pass a variable or even call a child method from a parent method. Please can you spread some light on this?
This makes no damn sense if you still have to use js.... whats the difference between using an ajax request and hitting a controller and using a partial view and then injecting the returned html into the proper dom element? can I somehow create a component thats for example, something like and on that page when i change the value of variable, it hits the view component and loads what it needs to that way... or does this still require js?
So, ViewComponent is killer because encapsulation and no side effects... If that's supposed to be convincing, then what's an example of a side effect in a partial view?
Other than being 'invoked' automatically, this video doesn't explain fully why a partial view cannot be used in place of another one of those MS additional-useless-feature called ViewComponent. If Microsoft developed what they think now is a useless partial view, now they're using another soon-to-be useless ViewComponent.
Using View Components everywhere is overkill and completely unnecessary. They each have their correct situational usage. Using either one everywhere is just wrong.
You could use blazor, just like you can pretty much use any tech you want. Blazor is just another tech that gives us the same result but goes about it very differently.
Excellent explanation. Thanks to that I decided to buy Peter's course about ASP.NET Core Tag Helpers and View Components on Pluralsight. I recommend.
Excellent video and very helpful. It's fantastic that it has an accompanying blog + git repository. Well done, thank you!
Thanks Peter! I was looking around for a simple explanation of view component in Razor and YT land this in my search... lucky me 🙂
This works great! I agree it is nicely self-contained and easy to work with. Thank you!
AARGH!!! I have been driving myself crazy! I am new to Razor Pages and am migrating a large application that extensively used nested ascx pages where a nested page would call a second nested page while passing objects forward. I can see no way of getting OnGet() on a nested view or Razor Page to be called, nor can I pass a variable or even call a child method from a parent method. Please can you spread some light on this?
Nice explanation
Thanks and
Greeting from the desert
Thanks! Which desert? I spend most my time now in Borrego Springs (desert community).
Thanks for this video, very succinct!
Thank you Peter , excelent video.
Thanks Peter!
how can you refresh a view component using javascript
Good info + Code, great!
This makes no damn sense if you still have to use js.... whats the difference between using an ajax request and hitting a controller and using a partial view and then injecting the returned html into the proper dom element?
can I somehow create a component thats for example, something like
and on that page when i change the value of variable, it hits the view component and loads what it needs to that way... or does this still require js?
So, ViewComponent is killer because encapsulation and no side effects...
If that's supposed to be convincing, then what's an example of a side effect in a partial view?
Other than being 'invoked' automatically, this video doesn't explain fully why a partial view cannot be used in place of another one of those MS additional-useless-feature called ViewComponent. If Microsoft developed what they think now is a useless partial view, now they're using another soon-to-be useless ViewComponent.
Thanks!
Using View Components everywhere is overkill and completely unnecessary. They each have their correct situational usage. Using either one everywhere is just wrong.
Why not use BLAZOR ??? it does exactly this with much ease!
You could use blazor, just like you can pretty much use any tech you want. Blazor is just another tech that gives us the same result but goes about it very differently.