Programmatic form submission RadzenTemplateForm #1680

Open
opened 2026-01-29 17:57:11 +00:00 by claunia · 0 comments
Owner

Originally created by @JvanderStad on GitHub (Mar 23, 2025).

Hello 🙋🏻‍♂️

II want to programmatically submit a RadzenTemplateForm from outside the Component by using @ref.

Currently the OnSubmit is protected

https://github.com/radzenhq/radzen-blazor/blob/master/Radzen.Blazor/RadzenTemplateForm.cs#L178

protected async Task OnSubmit()
{
...
}

I can make a PR for this. We can make the method public or we can create a new method that calls the OnSubmit method.

My intended usage:

<RadzenTemplateForm @ref="_refRadzenTemplateForm" />
private RadzenTemplateForm<Type>? _refRadzenTemplateForm { get; set; }

private async Task SubmitFormAsync()
{
	if (_refRadzenTemplateForm == null)
		return;

	await _refRadzenTemplateForm.OnSubmit();
}

What would be the preferred way to expose this?

Thanks

Originally created by @JvanderStad on GitHub (Mar 23, 2025). Hello 🙋🏻‍♂️ II want to programmatically submit a `RadzenTemplateForm` from outside the Component by using **@ref**. Currently the `OnSubmit` is `protected` https://github.com/radzenhq/radzen-blazor/blob/master/Radzen.Blazor/RadzenTemplateForm.cs#L178 ```c# protected async Task OnSubmit() { ... } ``` I can make a `PR` for this. We can make the method `public` or we can create a new method that calls the `OnSubmit` method. My intended usage: ```html <RadzenTemplateForm @ref="_refRadzenTemplateForm" /> ``` ```c# private RadzenTemplateForm<Type>? _refRadzenTemplateForm { get; set; } private async Task SubmitFormAsync() { if (_refRadzenTemplateForm == null) return; await _refRadzenTemplateForm.OnSubmit(); } ``` What would be the preferred way to expose this? Thanks
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/radzen-blazor#1680