Label Attribute

This attribute allows some additional modification to the label processing of the object template. You can still use the default DisplayName attribute to set the label value if you would like.


regular label displays before the field and is wrapped in the default wrapper from Templates.DefaultProfile.Editor.LabelContainer
[Label(Text = "Some Label")]
public string TextBox2 { get; set; }

additional options
/// <summary>
/// this property is here in case you want to validate that the field is required (through <see cref="System.ComponentModel.DataAnnotations.RequiredAttribute" />), 
/// but you do not want to show the html tag (<see ref="MvcTemplates.RequiredTagBuilder"/>) that indicates it is a required field
/// </summary>
public bool HideRequiredTag { get; set; }

/// <summary>
/// Renders the label after the field.
/// </summary>
public bool RenderAfterField { get; set; }

/// <summary>
/// Renders the label inside of the field wrapper instead of the normal wrapper
/// </summary>
public bool PutInFieldContainer { get; set; }

/// <summary>
/// prevents the label and it's wrapper from being rendered
/// </summary>
public bool DoNotRender { get; set; }

If you would like to customize the markup for all label containers. See the Configuration page.

Last edited Feb 21, 2011 at 4:13 AM by brk6004, version 3


No comments yet.