Use View Components, not Partial Views, in ASP.NET Core

Поделиться
HTML-код
  • Опубликовано: 18 ноя 2024

Комментарии • 19

  • @sulmarpl
    @sulmarpl 4 года назад +2

    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.

  • @Tolg
    @Tolg 5 лет назад +3

    Excellent video and very helpful. It's fantastic that it has an accompanying blog + git repository. Well done, thank you!

  • @ssirois
    @ssirois 9 месяцев назад

    Thanks Peter! I was looking around for a simple explanation of view component in Razor and YT land this in my search... lucky me 🙂

  • @ganjalaw
    @ganjalaw 5 лет назад +1

    This works great! I agree it is nicely self-contained and easy to work with. Thank you!

  • @spauldingcanada
    @spauldingcanada 3 года назад

    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?

  • @HA-fq5xc
    @HA-fq5xc 2 года назад

    Nice explanation
    Thanks and
    Greeting from the desert

    • @PeterKellner99
      @PeterKellner99  2 года назад

      Thanks! Which desert? I spend most my time now in Borrego Springs (desert community).

  • @DavidHouseGA
    @DavidHouseGA 5 лет назад +1

    Thanks for this video, very succinct!

  • @leonardosegars5758
    @leonardosegars5758 6 лет назад

    Thank you Peter , excelent video.

  • @bhanushkaekanayake9988
    @bhanushkaekanayake9988 5 лет назад

    Thanks Peter!

  • @szafar5797
    @szafar5797 3 года назад

    how can you refresh a view component using javascript

  • @miguelryy
    @miguelryy 5 лет назад

    Good info + Code, great!

  • @chadgregory9037
    @chadgregory9037 2 года назад

    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?

  • @just-Banks
    @just-Banks Год назад

    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?

  • @YOUTUBE_IS_WOKE
    @YOUTUBE_IS_WOKE 2 года назад +1

    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.

  • @ivandrofly
    @ivandrofly 5 лет назад

    Thanks!

  • @NBGTFO
    @NBGTFO Год назад

    Using View Components everywhere is overkill and completely unnecessary. They each have their correct situational usage. Using either one everywhere is just wrong.

  • @hqcart1
    @hqcart1 5 лет назад

    Why not use BLAZOR ??? it does exactly this with much ease!

    • @PeterKellner99
      @PeterKellner99  5 лет назад +1

      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.