Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Working on a Blazor app, my buttons aren't calling my methods

$
0
0

I'm working on a Blazor project for some personal learning, and I've hit an issue that I can't seem to figure out the solution to. That being most of my browser-side buttons don't seem to do anything, likely because they aren't calling my methods. I've checked my syntax, debugged my code, and checked for errors on browser side and I can't see anything that should be wrong. Everything I can find elsewhere says there shouldn't be a problem with my code, so I'm here to ask for help. Below is the razor page, 'cause I can't imagine that the problem is with my CS partial page.

Here's my razor page

        `@page "/deckedit"        @page "/deckedit/{DeckId}"        @using DeckBuilder.Shared        @if (!Saved)        {<section class="deck-edit"><h1 class="page-title">@Deck.DeckName</h1><EditForm Model="@Deck" OnValidSubmit="@HandleValidSubmit"             OnInvalidSubmit="@HandleInvalidSubmit" FormName="DeckEdit"><ValidationSummary></ValidationSummary><div class="form-group row"><label for="deckname" class="col-sm-3">Deck Name: </label><InputText id="deckname" class="form-control col-sm-8" @bind-            Value="@Deck.DeckName" placeholder="Enter deck name"></InputText><ValidationMessage class="offset-sm-3 col-sm-8" For="@(() =>             Deck.DeckName)"     /></div>                    @if (Deck.DeckId != 0)                    {<ul>                            @foreach (string card in Cards)                            {<li><li>@card</li><button type="button" @onclick="() =>             RemoveCard(card)">Remove Card</button></li>                             }</ul>                    }<div><input type="text" @bind="newCard" placeholder="Enter New Card"     /><button type="button" @onclick="AddCard">Add Card</button></div><button type="submit" class="btn btn-primary edit-btn">Save         Deck</button>                    @if (Deck.DeckId > 0)                    {<a class="btn btn-danger" @onclick="@DeleteDeck">Delete Deck</a>                    }</EditForm></section>        }        else        {<div class="alert @StatusClass">@Message</div>        }`

Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>