Json response using RadzenTemplateForm

Hi Everyone!

Have a good day!,

how to get data in json format using RadzenTemplateForm.

Hi @se.imranali,

Could you tell us what you are trying to achieve in more detail? Normally you can use the PostAsJsonAsync method of the HttpClient and just pass the value (the field or property you have set the Data of RadzenTemplateForm to).

@inject HttpClient HttpClient

<RadzenTemplateForm TItem="MyObject" Data="@data" Submit="@OnSubmit">
</RadzenTemplateForm>

@code {
   MyObject data = new MyObject();

   async Task OnSubmit()
   {
        await HttpClient.PostAsJsonAsync("/my-api", data);
   }
}

Thank you so much for response sir.

We can get response through RadzenTemplateForm using Action and Method attribute.?

No. In that case RadzenTemplateForm behaves as a regular <form>.