Class FormItem
Inheritance
Namespace: Syncfusion.Blazor.DataForm
Assembly: Syncfusion.Blazor.dll
Syntax
public class FormItem : OwningComponentBase
Constructors
FormItem()
Declaration
public FormItem()
Properties
ColumnSpan
Gets or sets the number of columns spanned by the cell.
Declaration
public Nullable<int> ColumnSpan { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Int32> | An integer representing the number of columns spanned by the cell. |
Remarks
The ColumnSpan property determines how many columns in a layout an element should occupy. Setting this property to a value greater than 1 will cause the element to span multiple columns, allowing for more flexible layout options. Use this property to control the horizontal span of a table cell within a table.
CssClass
Gets or sets one or more CSS classes that can be used to customize the appearance of a SfDataForm component field.
Declaration
public string CssClass { get; set; }
Property Value
Type | Description |
---|---|
System.String | Accept the System.String value. |
Remarks
One or more CSS classes to customize the appearance of the form field, such as by changing its colors, fonts, sizes, or other visual aspects.
The default value is String.Empty
.
EditorType
Gets or sets the editor used for the given field. If not provided, a default editor will be used based on the field data type.
Declaration
public FormEditorType EditorType { get; set; }
Property Value
Type | Description |
---|---|
FormEditorType |
Remarks
The FormEditorType enumeration defines different types of editors that can be used for form fields, such as TextBox, DatePicker, DropdownList, etc. By setting this property, you can customize the input method for each form field.
Field
Renders an editor for the specified field in the model.
Declaration
public string Field { get; set; }
Property Value
Type | Description |
---|---|
System.String | The name of the field in the model that the editor will render for as a string (case-sensitive). |
Remarks
The specifies the name of the field in the model for which the editor is being rendered.
You can set it as a plain string (e.g., Field="SomeField") or use the @nameof
expression for flat models (e.g., Field=@nameof(MyModelClass.SomeField)).
If a custom editor template is provided using the Template parameter, the Field parameter is not required.
ID
Gets or sets the ID of the SfDataForm component field.
Declaration
public string ID { get; set; }
Property Value
Type | Description |
---|---|
System.String | A string value that specifies the ID of the form field. |
Remarks
The ID property is typically used to uniquely identify an object within an application. It should be unique and immutable once set. When creating or modifying an object, ensure that the ID is unique and meaningful for efficient object management and retrieval.
IsEnabled
Gets or sets a value that specifies whether a SfDataForm component field is enabled or disabled.
Declaration
public bool IsEnabled { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
When the field is enabled, users can interact with it and trigger its associated action. When the field is disabled, it appears visually different and cannot be interacted with.
LabelText
Gets or sets the label text for a SfDataForm component field.
Declaration
public string LabelText { get; set; }
Property Value
Type | Description |
---|---|
System.String | A string representing the label text associated with the form field. |
Remarks
The LabelText property allows you to specify the text that serves as a label for a form field. Label text provides a descriptive title or caption for the field, helping users understand the purpose of the input or element. It is important for accessibility and providing a clear user experience.
Placeholder
Gets or sets the placeholder text for a SfDataForm component field.
Declaration
public string Placeholder { get; set; }
Property Value
Type | Description |
---|---|
System.String | A string value that specifies the placeholder text. |
Remarks
The Placeholder property allows you to specify text that appears inside a SfDataForm component field when it's empty. This text serves as a helpful hint to users, providing guidance on what kind of input is expected in the field. It is particularly useful for improving the user experience and accessibility of the form.
Template
Gets or sets the template for the form items to provide the custom components.
Declaration
public Template Template { get; set; }
Property Value
Type | Description |
---|---|
Template | The template content. The default value is null. |
Remarks
The Template property allows you to define a custom template for rendering a specific SfDataForm field. This template can include HTML markup, components, or other content to tailor the appearance to your specific requirements. It offers flexibility in designing SfDataForm field elements that go beyond standard rendering.
Methods
BuildRenderTree(RenderTreeBuilder)
Declaration
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder | __builder |
Dispose(Boolean)
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing |
OnAfterRenderAsync(Boolean)
Declaration
protected override Task OnAfterRenderAsync(bool firstRender)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | firstRender |
Returns
Type |
---|
System.Threading.Tasks.Task |
OnInitialized()
Declaration
protected override void OnInitialized()
OnParametersSetAsync()
Declaration
protected override Task OnParametersSetAsync()
Returns
Type |
---|
System.Threading.Tasks.Task |
UpdateComponent(Template)
Declaration
public virtual void UpdateComponent(Template Item)
Parameters
Type | Name | Description |
---|---|---|
Template | Item |