HelpMessage Attribute

[HelpMessage("A static Help Message")]        
public string TextBoxWithHelpMessage { get; set; }

[HelpMessage( typeof(ResourceFile), "MyHelpMessage" )]
public string TextBoxWithHelpMessageFromResourceFile { get; set; }

Customize the markup of the help message:

tweaking attirbutes only
[HelpMessage("A static Help Message", HtmlAttributeNames = new[]{ "id", "class" }, HtmlAttributeValues = new[]{ "helpMessageId", "some_class" } )]
public string TextBoxHelpMessageWithSpecificAttributes{ get; set; }

changing the wrapper
[HelpMessage("A custom wrapper for this help message", TagBuilderType = typeof(CustomHelpMessageWrapper) )]
public string HelpMessageWithCustomWrapper { get; set; }
public class CustomHelpMessageWrapper : TagBuilder
     public CustomHelpMessageWrapper() : base( "div" )
          this.Attributes["id"] = "helpMessageWithCustomWrapperId";
          this.AddCssClass( "some_class" );
          this.InnerHtml = "it's custom!";

If you would like to change the wrapper for all help messages. You can change the property on Templates.DefaultProfile.HelpMessage. See the Configuration documentation for more information.

Last edited Feb 22, 2011 at 3:15 AM by brk6004, version 11


No comments yet.