Posts

Showing posts from August, 2022

Dynamically Create and Delete Elements in Blazor

Image
This blog is going to explain how to create and delete elements in Blazor. Let's see step by step Step 1: Create Dynamic Element The code for creating dynamic elements is shown below. I created a class named Movie with the fields Name, ReleasedYear, and CoProduction. Inside the for loop, three textboxes were added to collect movie information. I also included a button to generate a new row of text boxes. @page   "/" < h4 > Dynamic Elements </ h4 > < style >      body  {          font-size :  12px ;     }        table  {          width :  50%   !important ;     } </ style >   < table   class = "table" >      < thead >          < tr >              < th > Movie Name </ th >              < th > Release Year </ th >              < th > Co Production </ th >          </ tr >      </ thead >      < tbody >          @for  ( int   i  =  0 ;  i