Hi Kapil,
Query 1 : ” I need to pass a parameter i.e Job_id to OkClick method when the Ok button is clicked in the SfDialog component. With the Job_id I need to call a method to delete the data from the database. ”
We recommend that you set the global variable to "Job-Id" when you press the delete key. This approach will enable you to retrieve the value of "Job-Id" from the global variable and pass it to the OkClick method, allowing you to delete data from the database.
@code { public int JobIdDelete; public int JobIdCancel; public async void OnCommandClicked(CommandClickEventArgs<GetBasicAnalysisJobsForUser> args) { if (args.CommandColumn.ID == "Delete") { this.JobIdDelete = args.RowData.Job_Id; } if (args.CommandColumn.ID == "Cancel") { this.JobIdCancel = args.RowData.Job_Id; } } |
Query 2 : “I am using the SfDialog component for both Delete and Cancel. How does the SfDialog component know that the pop up is for Delete and Cancel”
To meet your requirements, we suggest using the following code, which should help the SfDialog component identify whether the popup is for Delete or Cancel.
public async void OnCommandClicked(CommandClickEventArgs<GetBasicAnalysisJobsForUser> args) { if (args.CommandColumn.ID == "Delete") { this.ButtonClick = args.CommandColumn.ID; } } |
Please see the attached sample for your reference.
Regards,
Vinothkumar
Attachment:
DialogBoxComponet_65f32ef0_2839a65b.zip