Hello XAF Team,
I read this documentation topic: Error Handling in ASP.NET Applications (http://documentation.devexpress.com/#Xaf/CustomDocument2704).
This method is useful to provide feedback to end users: DevExpress.ExpressApp.Web.ErrorHandling.Instance.SetPageError
Could you please introduce similar methods like SetPageWarning, SetPageInfo and so on, into XAF Web UI, such that XAF developers can display 'inline' messages to end users without using popup windows (or ASPxPopupControl)? You know, it's difficult to popup warning or information (result of some business logic execution) in XAF Web UI.
Regards,
James
Platform-Agnostic API for Text Notifications
Answers approved by DevExpress Support
XAF 17.1+
Text notification display (e.g. confirmation messages, warnings, errors) has been simplified for desktop and Web XAF applications with the help of the platform-agnostic DevExpress.ExpressApp > ShowViewStrategyBase > ShowMessage method. You can quickly learn more about it from this blog as a preview of this functionality was already available in XAF v16.2.5+.
With v17.1, this functionality was greatly extended based on customer feedback and you can research it further in the FeatureCenter and SimpleProjectManager demos:
C#...
MessageOptions options = new MessageOptions();
options.Duration = 2000;
options.Message = string.Format("{0} task(s) have been successfully updated!", e.SelectedObjects.Count);
options.Type = InformationType.Success;
options.Web.Position = InformationPosition.Right;
options.Win.Caption = "Success";
options.Win.Type = WinMessageType.Flyout;
Application.ShowViewStrategy.ShowMessage(options);
...
We also look forward to hearing from you once you have had an opportunity to try this extended ShowMessage functionality in v17.1.
Other Answers
Hi James,
FOR OLDER VERSIONS
1. Display a message in a panel embedded at the view top/bottom
1.1. Introduce a new class, for example, with a static property to store text you want to show. You can also use the Session to store this text;
1.2. Create a WebControl descendant and override its Render method. In this method, create a new Literal control with the text from your store used on step 1 and add it to the Controls collection. Check the source code of our default ErrorInfoControl (…\DevExpress.ExpressApp.Web\Templates\ErrorInfoControl.cs) for more inspiration, if necessary.
1.3. Create a custom TemplateContent, add a new XafUpdatePanel control onto the TemplateContent and place the created control into the XafUpdatePanel control. For more details, refer to the How to: Customize an ASP.NET Template article.
In addition, see our FeatureCenter demo source as it shows another way of providing custom messages:
"%public%\Documents\DevExpress Demos 1X.X\Components\eXpressApp Framework\FeatureCenter\CS\FeatureCenter.Module\ShowHintController.cs"
"%public%\Documents\DevExpress Demos 1X.X\Components\eXpressApp Framework\FeatureCenter\CS\FeatureCenter.Module\HintAttribute.cs"
"%public%\Documents\DevExpress Demos 1X.X\Components\eXpressApp Framework\FeatureCenter\CS\FeatureCenter.Web\Default.aspx.cs"
2. Display a message via a custom popup window or window.alert in JavaScript
See an example at Displaying modal pop-up conformation dialog/message box.
3. Display a popup using the XafApplication.ShowViewStrategy.ShowViewInPopupWindow method
With v16.2, the display of Dialog Views (configurable confirmation messages, reminders, etc.) has been simplified for both Windows and Web based XAF applications. We've implelemented a new platform-independent XafApplication.ShowViewStrategy.ShowViewInPopupWindow method. Refer to the How to show complex dialogs on the client-side in XAF ASP.NET applications (similar to the MessageBox in Windows Forms) ticket for more details.
Thanks,
Dennis
Hello James,
Wow, I thought about a similar functionality while working on Displaying modal pop-up conformation dialog/message box. I think that it is something we can consider for the XAF's future. Thank you for registering this idea!
Thanks,
Dennis
Thanks Dennis! Hope these SetPageWarning / SetPageInfo and more methods will be introduced in v12.1 release. :)