Demos About Radzen
Search Results for

    Show / Hide Table of Contents

    Class RadzenTemplateForm<TItem>

    A component which represents a form. Provides validation support.

    Inheritance
    System.Object
    RadzenComponent
    RadzenTemplateForm<TItem>
    Implements
    IDisposable
    IRadzenForm
    Inherited Members
    RadzenComponent.Attributes
    RadzenComponent.Element
    RadzenComponent.MouseEnter
    RadzenComponent.MouseLeave
    RadzenComponent.ContextMenu
    RadzenComponent.Culture
    RadzenComponent.DefaultCulture
    RadzenComponent.OnMouseEnter()
    RadzenComponent.OnMouseLeave()
    RadzenComponent.OnContextMenu(Microsoft.AspNetCore.Components.Web.MouseEventArgs)
    RadzenComponent.Style
    RadzenComponent.Visible
    RadzenComponent.GetCssClass()
    RadzenComponent.GetId()
    RadzenComponent.Debounce(Func<Task>, Int32)
    RadzenComponent.UniqueID
    RadzenComponent.JSRuntime
    RadzenComponent.IsJSRuntimeAvailable
    RadzenComponent.OnInitialized()
    RadzenComponent.SetParametersAsync(ParameterView)
    RadzenComponent.Reference
    RadzenComponent.OnAfterRenderAsync(Boolean)
    RadzenComponent.RaiseContextMenu(Microsoft.AspNetCore.Components.Web.MouseEventArgs)
    RadzenComponent.RaiseMouseEnter()
    RadzenComponent.RaiseMouseLeave()
    RadzenComponent.Dispose()
    RadzenComponent.CurrentStyle
    Namespace: Radzen.Blazor
    Assembly: Radzen.Blazor.dll
    Syntax
    public class RadzenTemplateForm<TItem> : RadzenComponent, IDisposable, IRadzenForm
    Type Parameters
    Name Description
    TItem
    Examples
    <RadzenTemplateForm TItem="Model" Data=@model>
      <RadzenTextBox style="display: block" Name="Email" @bind-Value=@model.Email />
      <RadzenRequiredValidator Component="Email" Text="Email is required" Style="position: absolute" />
    </RadzenTemplateForm>
    @code {
     class Model
     {
       public string Email { get; set; }
     }
    
     Model model = new Model();
    }

    Constructors

    RadzenTemplateForm()

    Initializes a new instance of the RadzenTemplateForm<TItem> class.

    Declaration
    public RadzenTemplateForm()

    Properties

    Action

    Specifies the form action attribute. When set the form submits to the specified URL.

    Declaration
    public string Action { get; set; }
    Property Value
    Type Description
    System.String
    Examples
    <RadzenTemplateForm TItem="Model" Method="post" Action="/register" Data=@model>
      <RadzenTextBox style="display: block" Name="Email" @bind-Value=@model.Email />
      <RadzenRequiredValidator Component="Email" Text="Email is required" Style="position: absolute" />
    </RadzenTemplateForm>

    ChildContent

    Gets or sets the child content.

    Declaration
    public RenderFragment<EditContext> ChildContent { get; set; }
    Property Value
    Type Description
    RenderFragment<EditContext>

    Data

    Specifies the model of the form. Required to support validation.

    Declaration
    public TItem Data { get; set; }
    Property Value
    Type Description
    TItem

    EditContext

    Gets or sets the edit context.

    Declaration
    public EditContext EditContext { get; set; }
    Property Value
    Type Description
    EditContext

    The edit context.

    InvalidSubmit

    A callback that will be invoked when the user submits the form and IsValid is false.

    Declaration
    public EventCallback<FormInvalidSubmitEventArgs> InvalidSubmit { get; set; }
    Property Value
    Type Description
    EventCallback<FormInvalidSubmitEventArgs>
    Examples
    <RadzenTemplateForm TItem="Model" InvalidSubmit=@OnInvalidSubmit Data=@model>
      <RadzenTextBox style="display: block" Name="Email" @bind-Value=@model.Email />
      <RadzenRequiredValidator Component="Email" Text="Email is required" Style="position: absolute" />
    </RadzenTemplateForm>
    @code {
     class Model
     {
       public string Email { get; set; }
     }
    
     Model model = new Model();
    
     void OnInvalidSubmit(FormInvalidSubmitEventArgs args)
     {
    
     }
    }

    IsValid

    Returns the validity of the form.

    Declaration
    public bool IsValid { get; }
    Property Value
    Type Description
    System.Boolean

    true if all validators in the form a valid; otherwise, false.

    Method

    Specifies the form method attribute. Used together with Action.

    Declaration
    public string Method { get; set; }
    Property Value
    Type Description
    System.String
    Examples
    <RadzenTemplateForm TItem="Model" Method="post" Action="/register" Data=@model>
      <RadzenTextBox style="display: block" Name="Email" @bind-Value=@model.Email />
      <RadzenRequiredValidator Component="Email" Text="Email is required" Style="position: absolute" />
    </RadzenTemplateForm>

    OnInvalidSubmit

    Obsolete. Use InvalidSubmit instead.

    Declaration
    public EventCallback<FormInvalidSubmitEventArgs> OnInvalidSubmit { get; set; }
    Property Value
    Type Description
    EventCallback<FormInvalidSubmitEventArgs>

    Submit

    A callback that will be invoked when the user submits the form and IsValid is true.

    Declaration
    public EventCallback<TItem> Submit { get; set; }
    Property Value
    Type Description
    EventCallback<TItem>
    Examples
    <RadzenTemplateForm TItem="Model" Submit=@OnSubmit Data=@model>
      <RadzenTextBox style="display: block" Name="Email" @bind-Value=@model.Email />
      <RadzenRequiredValidator Component="Email" Text="Email is required" Style="position: absolute" />
    </RadzenTemplateForm>
    @code {
     class Model
      {
       public string Email { get; set; }
     }
    
     Model model = new Model();
    
     void OnSubmit(Model value)
     {
    
     }
    }

    Methods

    AddComponent(IRadzenFormComponent)

    Adds the specified component to the form.

    Declaration
    public void AddComponent(IRadzenFormComponent component)
    Parameters
    Type Name Description
    IRadzenFormComponent component

    The component to add to the form.

    BuildRenderTree(RenderTreeBuilder)

    Declaration
    protected override void BuildRenderTree(RenderTreeBuilder builder)
    Parameters
    Type Name Description
    RenderTreeBuilder builder

    FindComponent(String)

    Finds a form component by its name.

    Declaration
    public IRadzenFormComponent FindComponent(string name)
    Parameters
    Type Name Description
    System.String name

    The name.

    Returns
    Type Description
    IRadzenFormComponent

    The component whose Name equals to name; null if such a component is not found.

    GetComponentCssClass()

    Gets the component CSS class.

    Declaration
    protected override string GetComponentCssClass()
    Returns
    Type Description
    System.String
    Overrides
    RadzenComponent.GetComponentCssClass()

    OnParametersSet()

    Declaration
    protected override void OnParametersSet()

    OnSubmit()

    Handles the submit event of the form.

    Declaration
    protected async Task OnSubmit()
    Returns
    Type Description
    Task

    RemoveComponent(IRadzenFormComponent)

    Removes the component from the form.

    Declaration
    public void RemoveComponent(IRadzenFormComponent component)
    Parameters
    Type Name Description
    IRadzenFormComponent component

    The component to remove from the form.

    Implements

    IDisposable
    IRadzenForm

    Introducing Radzen Blazor Studio

    Radzen Blazor Studio is a software development environment that empowers developers to design, build and deploy Blazor applications without the traditional hurdles. Write less code and get more done.

    Learn More

    Download Now
    Download Now
    In This Article
    Back to top Radzen Blazor Components, © 2018-2025 Radzen. Source Code licensed under MIT