One may notice when using the code samples from Ektron Developer Reference Guide, if copied verbatim, that the code will error on a MessageUtilities object. For example, the error may be thrown on the following lines:
uxPageMultiView.SetActiveView(uxViewMessage); MessageUtilities.UpdateMessage(uxMessage, ex.Message, Message.DisplayModes.Error); uxPageMultiView.SetActiveView(uxViewMessage);
This was specifically developed for the OnTrek starter site as a way to update messages throughout the process of the API calls in the samples.
The purpose of this article is to provide a way to use the MessageUtilites.UpdateMessage method that is found on the code samples in the Reference Guide.
This sample contains
- MessageUtilites.cs - Class file
- ContentGetList.aspx - Demonstrates how the class file works with the samples from the Reference Guide
To use this class:
- Place the MessageUtilites.cs from the Zip file in the Site root's App_code folder located: C:\inetpub\wwwroot\ Site Name\App_Code\
- Reference the following namespaces in the code behind if creating a new template:
- using Ektron.Cms.Min;
- using Ektron.Cms.Framework.UI.Controls.EktronUI;
- Wrap the List tags (
- ) from the sample on the Developer Reference Guide with an asp multiview control (this is demonstrated on the sample attached):
<asp:MultiView ID="uxPageMultiView" runat="server" ActiveViewIndex="0"></asp:MultiView>