|
<SfDialog @ref="Dialog" @bind-Visible="@isVisible" Width="250px" ShowCloseIcon="true" IsModal="true">
<DialogTemplates>
<Header> Delete Record</Header>
<Content> You are about to Delete a Record @SelectedData.OrderID ?</Content> @*here you can customize the dialog content text as per your need*@
</DialogTemplates>
...
</SfDialog>
<SfGrid @ref="Grid" DataSource="@Orders" AllowPaging="true" Toolbar="@(new List<string>() { "Add", "Edit", "Delete", "Update", "Cancel" })" Height="315">
<GridEvents OnActionBegin="OnActionBegin" OnActionComplete="OnActionComplete" RowSelected="RowSelectHandler" TValue="Order"></GridEvents>
...
</SfGrid>
@code{
...
private SfDialog Dialog;
private bool isVisible { get; set; } = false;
private bool DeleteConfirm { get; set; } = false;
private void OkClick()
{
DeleteConfirm = true;
Grid.DeleteRecord(); //delete the record while clikcing OK button
this.isVisible = false; //hide external dialog
}
private void CancelClick()
{
this.isVisible = false;
}
public void OnActionBegin(ActionEventArgs<Order> Args)
{
if (Args.RequestType.ToString() == "Delete" && !DeleteConfirm)
{
Args.Cancel = true;
Dialog.Show(); //show external dialog
}
}
public void OnActionComplete(ActionEventArgs<Order> Args)
{
if (Args.RequestType.ToString() == "Delete" && DeleteConfirm)
{
DeleteConfirm = false; //set flag to false
}
}
...
} |