Skip to content

SwalService RenderFragment #5289

Answered by Koreets61
Koreets61 asked this question in Q&A
Feb 3, 2025 · 2 comments · 7 replies

You must be logged in to vote

The solution on how to do it right, maybe it will be useful to someone.

private async Task TriggerAlertReset()
{

}

var op = new SwalOption()
{
    Category = SwalCategory.Warning,
    Title = Resources.Strings.AppRes.ResourceManager.GetString("_Attention"),
    Content = "Test",
    ShowClose = false,
    IsAutoHide = false,
    ButtonTemplate = new RenderFragment(builder =>
    {
        builder.OpenElement(1, "button");
        builder.AddAttribute(2, "class", "mt-4 btn btn-primary-fix btn-xxl btn-block");
        builder.AddAttribute(3, "onclick", EventCallback.Factory.Create(this, TriggerAlertReset));
        builder.AddContent(4, "Ok");
        builder.CloseElement();
    })
};
Swa…

Replies: 2 comments 7 replies

You must be logged in to vote
7 replies
@Koreets61

@Koreets61

@ArgoZhang

@Koreets61

@Koreets61

You must be logged in to vote
0 replies
Answer selected by Koreets61
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants