Skip to content

FormWidthAttribute class

namespace: Serenity.ComponentModel   assemblySerenity.Net.Core

Sets the CSS class for the field on forms only. Useful for Bootstrap grid, e.g. col-md-4 etc.

[AttributeUsage(AttributeTargets.All)]
public class FormWidthAttribute : Attribute

Public Members

name description
FormWidthAttribute() Creates a FormWidth attribute with no initial column classes. Make sure to set properties to make it useful.
FormWidthAttribute(…) Creates a FormWidth attribute with given custom css class, like col-md-6 col-sm-4 etc.
JustThis { get; set; } Applies this form width (e.g. bootstrap grid size) to just the current field and doesn't cancel a prior form width attribute with an UntilNext attribute. Don't set UntilNext = true if you set JustThis = true, as they are exclusive.
Large { get; set; } Gets or sets the number of columns (1..12) in large devices (width >= 1200px, large desktops).
Medium { get; set; } Gets or sets the number of columns (1..12) in medium devices (width >= 992px, medium desktops).
Small { get; set; } Gets or sets the number of columns (1..12) in small devices (width >= 768px, tablets).
UntilNext { get; set; } Applies this form width (e.g. bootstrap grid size) to all following fields until another FormWidth attribute.
Value { get; protected set; } Gets the CSS class that will be applied to the field.
XSmall { get; set; } Gets or sets the number of columns (1..12) in extra small devices (width < 768px, mobile phones).

See Also