sea cryptid
sea cryptid
CC#
Created by sea cryptid on 2/1/2023 in #help
❔ Name "PostsService" does not exist in the current context
@using BlazorBookGroup.Data
. . .
private PostsService postsService = new();

protected override void OnInitialized() => posts = postsService.GetPosts();
@using BlazorBookGroup.Data
. . .
private PostsService postsService = new();

protected override void OnInitialized() => posts = postsService.GetPosts();
5 replies
CC#
Created by sea cryptid on 2/1/2023 in #help
❔ namespace 'Models' does not exist in the namespace 'BlazorBookGroup'
11 replies
CC#
Created by sea cryptid on 1/31/2023 in #help
❔ 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.
2 replies
CC#
Created by sea cryptid on 1/29/2023 in #help
❔ Bootstrap modal in razor page closing for one page but not another
When I click the plus button on my application a modal pops up. (good) But when I click any button in the modal it closes (this may work for what I am doing but not sure why). I have
<div class="modal-footer">
<button class="btn btn-primary">Submit</button>
<button class="btn btn-secondary">Close</button>
<button @onclick="Debug">Sample</button>
</div>
<div class="modal-footer">
<button class="btn btn-primary">Submit</button>
<button class="btn btn-secondary">Close</button>
<button @onclick="Debug">Sample</button>
</div>
And the debugger is not hitting by Debug function in VS. Not sure the best way to debug this. In another page I have buttons in the footer and none of them will close the modal. I want to investigate why the behavior differs in these two instances.
17 replies
CC#
Created by sea cryptid on 1/20/2023 in #help
❔ The name "onclick" does not exist in the current context
23 replies
CC#
Created by sea cryptid on 1/17/2023 in #help
❔ Trying to create my first non-tutorial ASP.net project running into small error
6 replies