A component which represents a form. Provides validation support.
RadzenComponent.SetParametersAsync
RadzenComponent.OnAfterRenderAsync
RadzenComponent.RaiseContextMenu
RadzenComponent.RaiseMouseEnter
RadzenComponent.AddContextMenu
RadzenComponent.RaiseMouseLeave
RadzenComponent.OnBecameInvisible
RadzenComponent.DefaultCulture
RadzenComponent.IsJSRuntimeAvailable
ComponentBase.OnInitializedAsync
ComponentBase.OnParametersSetAsync
ComponentBase.StateHasChanged
ComponentBase.ShouldRender
ComponentBase.OnAfterRender
ComponentBase.InvokeAsync
ComponentBase.DispatchExceptionAsync
ComponentBase.RendererInfo
ComponentBase.Assets
ComponentBase.AssignedRenderMode
Namespace: Radzen.Blazor
Assembly: Radzen.Blazor.dll
public class RadzenTemplateForm<TItem> : RadzenComponent, IComponent, IHandleEvent, IHandleAfterRender, IRadzenForm| Name | Description |
|---|---|
| TItem |
<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();
}Initializes a new instance of the RadzenTemplateForm<T> class.
public RadzenTemplateForm<TItem>()Specifies the form action attribute. When set the form submits to the specified URL.
public string Action { get; set; }
| Type | Description |
|---|---|
| string | Specifies the form action attribute. When set the form submits to the specified URL. |
<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>Gets or sets the child content.
public RenderFragment<Forms.EditContext> ChildContent { get; set; }
| Type | Description |
|---|---|
| RenderFragment<Forms.EditContext> | Gets or sets the child content. |
Specifies the model of the form. Required to support validation.
public TItem Data { get; set; }
| Type | Description |
|---|---|
| TItem | Specifies the model of the form. Required to support validation. |
Gets or sets the edit context.
public Forms.EditContext EditContext { get; set; }
| Type | Description |
|---|---|
| Forms.EditContext | Gets or sets the edit context. |
A callback that will be invoked when the user submits the form and IsValid is false.
public EventCallback<FormInvalidSubmitEventArgs> InvalidSubmit { get; set; }
| Type | Description |
|---|---|
| EventCallback<FormInvalidSubmitEventArgs> | A callback that will be invoked when the user submits the form and IsValid is false. |
<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)
{
}
}Returns the validity of the form.
public bool IsValid { get; }
| Type | Description |
|---|---|
| bool | Returns the validity of the form. |
Specifies the form method attribute. Used together with Action.
public string Method { get; set; }
| Type | Description |
|---|---|
| string | Specifies the form method attribute. Used together with Action. |
<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>Obsolete. Use InvalidSubmit instead.
public EventCallback<FormInvalidSubmitEventArgs> OnInvalidSubmit { get; set; }
| Type | Description |
|---|---|
| EventCallback<FormInvalidSubmitEventArgs> | Obsolete. Use InvalidSubmit instead. |
A callback that will be invoked when the user submits the form and IsValid is true.
public EventCallback<TItem> Submit { get; set; }
| Type | Description |
|---|---|
| EventCallback<TItem> | A callback that will be invoked when the user submits the form and IsValid is true. |
<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)
{
}
}public void AddComponent(IRadzenFormComponent component)
| Type | Name | Description |
|---|---|---|
| IRadzenFormComponent | component |
protected override void BuildRenderTree(Rendering.RenderTreeBuilder builder)
| Type | Name | Description |
|---|---|---|
| Rendering.RenderTreeBuilder | builder |
public IRadzenFormComponent FindComponent(string name)
| Type | Name | Description |
|---|---|---|
| string | name |
| Type | Description |
|---|---|
| IRadzenFormComponent |
protected override string GetComponentCssClass()
| Type | Description |
|---|---|
| string |
Handles the submit event of the form.
protected Task OnSubmit()
| Type | Description |
|---|---|
| Task |
public void RemoveComponent(IRadzenFormComponent component)
| Type | Name | Description |
|---|---|---|
| IRadzenFormComponent | component |