alexa
menu

Blazor

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Search Results for

    Show / Hide Table of Contents

    Class FormTemplate

    Represents a template component within the SfDataForm that allows custom content or components to be used for rendering form items.

    Inheritance
    object
    ComponentBase
    OwningComponentBase
    SfOwningComponentBase
    FormTemplate
    Implements
    IComponent
    IHandleEvent
    IHandleAfterRender
    IDisposable
    Inherited Members
    ComponentBase.Assets
    ComponentBase.AssignedRenderMode
    ComponentBase.BuildRenderTree(RenderTreeBuilder)
    ComponentBase.DispatchExceptionAsync(Exception)
    ComponentBase.InvokeAsync(Action)
    ComponentBase.InvokeAsync(Func<Task>)
    ComponentBase.OnAfterRender(bool)
    ComponentBase.OnAfterRenderAsync(bool)
    ComponentBase.OnInitialized()
    ComponentBase.OnParametersSet()
    ComponentBase.OnParametersSetAsync()
    ComponentBase.RendererInfo
    ComponentBase.SetParametersAsync(ParameterView)
    ComponentBase.ShouldRender()
    ComponentBase.StateHasChanged()
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    OwningComponentBase.IsDisposed
    OwningComponentBase.ScopedServices
    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 bool value indicating whether to dispose managed resources in addition to unmanaged resources.

    Overrides
    OwningComponentBase.Dispose(bool)
    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
    Overrides
    ComponentBase.OnInitializedAsync()

    Implements

    IComponent
    IHandleEvent
    IHandleAfterRender
    IDisposable
    In this article
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved