Eminem
Eminem

Reputation: 7484

How to create a message dialog or popup using devexpress xaf

How would I create or is there built in functionality in XAF to display a message box in a XAF web application?

Upvotes: 1

Views: 9342

Answers (3)

alexkovelsky
alexkovelsky

Reputation: 4198

The new XAF 17 has Toast Notification:

Application.ShowViewStrategy.ShowMessage(options);

In previous versions you can use JavaScript alert:

WebWindow.CurrentRequestWindow.RegisterClientScript("XafMessageBox", "alert('" + message + "');");

If you need to display a dialog with "OK"/"Cancel" or "Yes"/"No", use this object:

[NonPersistent]
public class ConfirmationPopup
{
    public ConfirmationPopup(string prompt)
    {
        Prompt = prompt;
    }

    public string Prompt { get; private set; }
}

And this code in View controller:

private void ShowConfirmationPopup(string prompt)
{
   var confirmationView = Application.CreateDetailView(Application.CreateObjectSpace(), new ConfirmationPopup(prompt), View);
   Application.ShowViewStrategy.ShowViewInPopupWindow(confirmationView, PopupConfirmed, PopupCancelled, okCaption, cancelCaption);
}

private void PopupCancelled()
        {
        }

    private void PopupConfirmed()
    {
    }

Upvotes: 0

shamp00
shamp00

Reputation: 11326

There are two approaches.

You can use the ConfirmationMessage property of any action.

For more advanced scenarios, there is a sample project attached to this support centre ticket which demonstrates how to display a dialog via a PopupWindowShowAction.

Upvotes: 2

Saif Khan
Saif Khan

Reputation: 18792

You need to look at "Actions" and "Pop-up Window". Check out:

Action that Displays a Pop-up Window

Upvotes: 1

Related Questions