Last Updated: 06 May 2021 08:46 by ADMIN
Created on: 06 May 2021 08:41
Category: Editor
Type: Bug Report
Cannot clear the editor content when placed in the form item template

I cannot clear the content area of the TelerikEditor when the component is placed in the Form Item Template.


Below, you can find a workaround solution:

@using System.ComponentModel.DataAnnotations;
@using Telerik.Blazor.Components.Editor

<TelerikForm Model="@Model" OnSubmit="@OnSubmitHandler">
        <DataAnnotationsValidator />
        <ValidationSummary />
                <TelerikEditor @bind-Value="@Model.Name" @ref="@EditorRef" />

@code {
    public SampleData Model { get; set; } = new SampleData();
    public TelerikEditor EditorRef { get; set; }

    private async Task OnSubmitHandler(EditContext editContext)
        bool isFormValid = editContext.Validate();

        if (isFormValid)
            //some logic here
            await EditorRef.ExecuteAsync(new HtmlCommandArgs("setHtml", "")); //workaround

            //clear the content of the editor to let the user type anew
            Model.Name = String.Empty;

    public class SampleData
        [MinLength(30, ErrorMessage = "The content should be minimum 30 characters long.")]
        public string Name { get; set; }