I want to add a confirmation dialog when a user clicks a delete button.
Can this be done with the Radzen Blazor components or do I need to create my own component using Bootstrap modal: https://getbootstrap.com/docs/4.0/components/modal/
When I put this in the code block of myPage.razor I don't get compile errors which I do get when I put the code in myPage.razor.cs.
My delete method is in myPage.razor.cs, but it has no access to ShowSimpleDialog().
How do I change the code of ShowSimpleDialog() to make it work in my code-behind file or even better as a generic ConfirmDelete component?
First, you have to create a component for the dialog layout. In the component, please add the line @inject Radzen.DialogService ds;
Then put your <RadzenCard> code to the component. Let say the component name is "CustomDialog".
Finally, change your DialogService.OpenAsync line to:
async Task ShowSimpleDialog() => await DialogService.OpenAsync<CustomDialog>("Simple Dialog",null);
If your component need to be passed parameters, change the null to the parameter dictionary.
I am new to use Radzen. I would like to use DialogService.Confirm() to delete a row of record. I wonder how to pass the delete function when I click the button "Yes".
<RadzenButton Text=@($"Show confirm dialog") Click="@(args => dialogService.Confirm("Are you sure?", "MyTitle", new ConfirmOptions() { OkButtonText = "Yes", CancelButtonText = "No" }))" />
Any hint will be greatly appreciated.
What is a modal page? You need to be more specific @Sammy - it isn't clear if you are using the confirmation from another Radzen dialog or something else.
Hi @korchev , I have a Delete button on a TemplateForm on a Radzen Dialog, so when I click on it the confirmation message is hidden behind the main Dialog page(open as a modal). I will share screenshots to make it more clearer.