How to clear radzentextbox values in editform after submit?

I have an edit form with some radzen textbox inside and after I invoke the "OnValidSubmit", I want to clear the form ready for use for another user.

I've tried giving the radzentextbox a name attribute and then trying to target this but I cant seem to. Any ideas as to how to achieve this?

<EditForm Model="_model" OnValidSubmit="ClearForm">
                <RadzenCard>
<label>Username</label>
                    <RadzenTextBox @bind-Value=_model.Username Placeholder="Username" Name="UsernameTB"></RadzenTextBox>
                    <hr />
                    <RadzenButton ButtonType="Radzen.ButtonType.Submit" Text="Clear" />
                </RadzenCard>
            </EditForm>
private async Task ClearForm() {
// clear form here
}

Please could anyone give me some help on this thank you!

Maybe you can simply create new instance of the object used as form model.

1 Like

hi enchev, how do i create new instance of my model?

Something like:

_model = new MyModel { Username = "" };
1 Like

Thank you korechev, this works perfectly! lovely