DialogFactory.Dialogs.PromptAsync is there a way to distinguish cancel from ok without entering a value?

2 Answers 541 Views
Dialog
Robert
Top achievements
Rank 1
Iron
Iron
Robert asked on 09 Jun 2022, 07:45 PM

The DialogFactory.Dialogs methods are really convenient but the prompt is missing some functionality:

- how can u distinguish pressing Cancel from pressing Ok without entering a value (both return null)

- there should be a way to make it mandatory (solves the above)

- what about setting a default value?

 

or am I missing something?

2 Answers, 1 is accepted

Sort by
0
Timothy J
Top achievements
Rank 2
Bronze
Iron
Iron
answered on 09 Jun 2022, 11:36 PM
>>

- how can u distinguish pressing Cancel from pressing Ok without entering a value (both return null)

<<

 

Do you mean ConfirmAsync?

I believe it is just a boolean.    True = Ok, False = Cancel (or close)

 


if (!(await Dialogs.ConfirmAsync(s.ToString(), "Delete?"))) return;

 

Robert
Top achievements
Rank 1
Iron
Iron
commented on 10 Jun 2022, 07:14 AM

No I mean this one:

Task<string> PromptAsync(string text, string title)

0
Timothy J
Top achievements
Rank 2
Bronze
Iron
Iron
answered on 10 Jun 2022, 03:35 PM | edited on 10 Jun 2022, 03:35 PM

Ok.

>>

- how can u distinguish pressing Cancel from pressing Ok without entering a value (both return null)

<<

I think if you need to know the differences between the nulls you're going to have to move away from the predefined dialogs and use the custom buttons:  Blazor Dialog Action Buttons | Telerik UI for Blazor

Tags
Dialog
Asked by
Robert
Top achievements
Rank 1
Iron
Iron
Answers by
Timothy J
Top achievements
Rank 2
Bronze
Iron
Iron
Share this question
or