Hello Trevor Park,
In order to have a working message control, you should declare it in an .ascx or .aspx file in the following way:
|<sfMsg:MessageControl runat="server" ID="messageCtrl"> |
| <ItemTemplate> |
| <asp:Label runat="server" ID="messageText"></asp:Label> |
| </ItemTemplate> |
Note that the label with "messageText
id is a required control used to show the message text.
If you are adding the control dynamically to the controls collection and you are not providing template to its ItemTemplate property, it would use its default template which has exactly the same controls structure as the code declaration above.
The Message Control is visible only when the Message property of the control has a value different from null or empty in the OnPreRender phase. In other words, if you run the code below in some controls event or a page load event, it will show you the "Hello World" text:
|MessageControl msgCtrl = new MessageControl(); |
|msgCtrl.Message = "Hello World!"; |
|msgCtrl.Mode = MessageMode.Success; |
The Mode property is used to indicate whether the text should be shown in red or green highlighting text.
the Telerik team