Blazor Tutorial C# - Part 5 - Blazor Component Reference

Поділитися
Вставка
  • Опубліковано 1 гру 2024

КОМЕНТАРІ • 24

  • @miguelsegura1859
    @miguelsegura1859 3 місяці тому +1

    Thanks for the clear and concise explanation.

  • @djrmarketing598
    @djrmarketing598 Рік тому +1

    As a long time .NET programmer (and previously VB / Classic ASP), I feel a huge callback in Blazor to Classic ASP, combining code into the page but with a seamless combination of server side and client side code without needing to implement heavy AJAX functions. At first glance, reading articles on Blazor how-to's I couldn't understand them that well. But your series has proven to be invaluable - I just started converting one of my current JS AJAX + Web API 2 projects into Blazor and with only a few hours of tutorials I'm almost up to speed with Blazor. Thank you! I can't wait to watch more of your videos.

    • @CodingDroplets
      @CodingDroplets  Рік тому

      Thank You so much! Glad to hear that. Your words mean a lot to me.

  • @piriyaie
    @piriyaie 2 місяці тому +1

    It's somehow not quite clear to me why exactly we needed this @ref now.

    • @piriyaie
      @piriyaie 2 місяці тому +1

      Ok. I have just understood it. This is the reference to this ContactList object, which we have added to Index.razor.

    • @CodingDroplets
      @CodingDroplets  2 місяці тому

      Glad you figured it out! Yes, exactly! The @ref directive allows you to get a reference to the razor component in the code-behind, so you can interact with it programmatically.

  • @evilroxxx
    @evilroxxx Рік тому +1

    How do you pass input arguments to the @onclick event handler method? Is it possible? Please share an example

    • @CodingDroplets
      @CodingDroplets  Рік тому +2

      Great question! Yes, it is possible to pass input arguments to the @onclick event handler method in Blazor. You can achieve this by using lambda expressions as below.
      Click me!

  • @noahyannis2465
    @noahyannis2465 2 роки тому +2

    Somehow the upper close button of the popup isn't working for me. Instead of a cross it's a weird rectangle...





    @HeadingContent



    @BodyContent


    Close
    Confirm

    • @CodingDroplets
      @CodingDroplets  2 роки тому +1

      Please confirm you are including bootstrap CSS file (css/bootstrap/bootstrap.min.css) in the _Layout.cshtml file.

    • @noahyannis2465
      @noahyannis2465 2 роки тому +2

      @@CodingDroplets I changed the line to × and now it works. :)

    • @CodingDroplets
      @CodingDroplets  2 роки тому +1

      Great! ...

  • @JtendraShahani
    @JtendraShahani Рік тому +1

    Can anyone please recommend a bootstrap 5 snippet extension for Visual Studio 2022. It would be helpful.

    • @CodingDroplets
      @CodingDroplets  Рік тому

      There are several options available that you can explore, including some licensed solutions. I recommend searching the Visual Studio Marketplace for extensions that fit your needs.

  • @benli7348
    @benli7348 Рік тому +1

    Hi, it is one of the good online tutorials. Do you have the complete source code to download? or which project in your gitgub?

    • @CodingDroplets
      @CodingDroplets  Рік тому

      Thank you for your kind words and interest in my video tutorial. Unfortunately, I do not have the complete source code for download as this was just an explanation video.

  • @sarahfox3652
    @sarahfox3652 2 роки тому +1

    Is there a github link that we can use to download this codebase?

    • @CodingDroplets
      @CodingDroplets  Рік тому

      No .. Atleast you've to understand few concepts by watching the video

  • @evilroxxx
    @evilroxxx 2 роки тому +1

    With this component available as a reference why would anyone want to use [Parameter] attribute and pass values that way? Why can’t we simply reference all components and set the values like how you’re setting them using methods however pass the actual values in the method params

    • @CodingDroplets
      @CodingDroplets  2 роки тому

      Without the [Parameter] attribute, those are just public properties. The values for properties with [Parameter] attribute can be assigned from the page design.

  • @francosimonini7103
    @francosimonini7103 2 роки тому +1

    When I put the tag in ContactList.razor component I have an error "RZ10012: Found markup element with unexpected name 'DeleteConfirmation'. If this is intended to be a component, add @using directive for its namespace". The DeleteConfirmation componend is in the Shared folder and my _imports.razor has the @using directive for the Shared directory... I don't understand what is wrong. thank ypu

    • @francosimonini7103
      @francosimonini7103 2 роки тому +1

      Solved: I created a new DeleteConfirmation2.razor component and copied into it the code of the "old" component. Then I have changed the tag in ContactList.razor to refer to the "new" component and deleted the "old" DeleteConfirmation.razor component and the compiled the project with no errors. Finally I renamed the "new" component back to the "old" DeleteConfirmation.razor and changed back also the reference in ContactList.razor component. It clearly wasn't an error in the code but a VS2022 bug....

    • @CodingDroplets
      @CodingDroplets  2 роки тому

      Glad to know the issue is fixed.