Class FormTemplate
Represents a template component within the SfDataForm that allows custom content or components to be used for rendering form items.
Inherited Members
Namespace: Syncfusion.Blazor.DataForm
Assembly: Syncfusion.Blazor.dll
Syntax
public class FormTemplate : SfOwningComponentBase, IComponent, IHandleEvent, IHandleAfterRender, IDisposable
Remarks
This component provides the flexibility to inject custom HTML or Blazor components as part of a form. You can use the Syncfusion.Blazor.DataForm.FormTemplate.ChildContent property to supply your own layout and logic.
Examples
The following example demonstrates how to use a FormTemplate to provide a custom UI for a field inside SfDataForm:
<SfDataForm Model="SampleModel">
<FormItems>
<FormItem Field="@nameof(SampleModel.FieldValue)">
<Template>
<div class="my-template">
<label for="nameId">Custom Label:</label>
<input type="text" id="nameId" @bind-value="@SampleModel.FieldValue" />
</div>
</Template>
</FormItem>
</FormItems>
</SfDataForm>
Constructors
FormTemplate()
Declaration
public FormTemplate()
Methods
Dispose()
Releases unmanaged resources used by the FormTemplate component.
Declaration
public virtual void Dispose()
Remarks
This method should be called to dispose of the template resources and references held by this instance when it is no longer needed.
Examples
var template = new FormTemplate();
template.Dispose();
Dispose(bool)
Releases unmanaged resources used by the FormTemplate component and, optionally, managed resources.
Declaration
protected override void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | disposing | A |
Overrides
Remarks
Call this method with disposing set to true to dispose both managed and unmanaged resources.
When disposing is false, only unmanaged resources are released.
OnInitializedAsync()
Declaration
protected override Task OnInitializedAsync()
Returns
| Type |
|---|
| Task |