I have Blazor server app, and how can I dynamically add new input textboxes on button click and remove it and get the value of all the input textboxes on submit button click so that I can save them in the database.
@for (int i = count; i >= 1; i--)
{
<div class="row">
<input type="text" @bind-value="@text_val" /> <p>@i</p><p>@count</p>
</div>
}
<div class="row">
<button @onclick=@(() => Increment())>Add User</button>
</div>
@code {
public string text_val;
public int count = 1;
public void Increment()
{
count = count + 1;
}
}
Any help will be great. Thank you