© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
1 reply
sea cryptid

❔ OnSubmit in ASP.NET EditForm is not triggering debugger in VS

I have
@page "/form-example-1"
@using Microsoft.Extensions.Logging
@using BookGroup.Models 
@inject ILogger<SubmitPostModal> Logger
@using Microsoft.AspNetCore.Components.Forms

<div class="modal fade center" tabindex="-1" role="dialog" id="add-post-modal">
    <div class="modal-content">
        <EditForm Model="@examplePost" OnSubmit="@HandleSubmit">
            <InputText id="inputQuote" @bind-Value="examplePost.Quote" />
            <button type="submit">Submit</button>
        </EditForm>
    </div>
</div>


@code {
    private BookGroup.Models.Post examplePost = new BookGroup.Models.Post();

    private void HandleSubmit()
    {
        Logger.LogInformation("HandleSubmit called");

        // Process the form
    }
}
@page "/form-example-1"
@using Microsoft.Extensions.Logging
@using BookGroup.Models 
@inject ILogger<SubmitPostModal> Logger
@using Microsoft.AspNetCore.Components.Forms

<div class="modal fade center" tabindex="-1" role="dialog" id="add-post-modal">
    <div class="modal-content">
        <EditForm Model="@examplePost" OnSubmit="@HandleSubmit">
            <InputText id="inputQuote" @bind-Value="examplePost.Quote" />
            <button type="submit">Submit</button>
        </EditForm>
    </div>
</div>


@code {
    private BookGroup.Models.Post examplePost = new BookGroup.Models.Post();

    private void HandleSubmit()
    {
        Logger.LogInformation("HandleSubmit called");

        // Process the form
    }
}

And when I press the "submit" button, nothing happens when I put a debug on the Logger so I assume that no event is being fired.
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

ASP.NET API Controller not returning values shown in debugger
C#CC# / help
3y ago
ASP.NET vs generic .NET [Answered]
C#CC# / help
4y ago
ASP.NET CORE MVC VS ASP.NET CORE WEB API
C#CC# / help
17mo ago
❔ ASP.NET Core web app vs ASP.net web application(.NET Framework)
C#CC# / help
4y ago