I think the following is what you are trying to do if you have the RDLC report working from your previous thread.
Blazor page in the client project uses a standard form to post user values to an API controller.
@page "/apiclient"
@using BlazorWebAssembly.Shared
<PageTitle>ApiClient</PageTitle>
<h3>ApiClient</h3>
<div>
<form action="/api/values" method="post">
@for (int i = 0; i < values?.Count(); i++)
{
<div>
<input name="@($"[{i}].Id")" value="@values[i].Id" />
<input name="@($"[{i}].Name")" value="@values[i].Name" />
</div>
}
<div>
<input type="submit" name="submit" value="submit" />
</div>
</form>
</div>
@code {
private List<ValuesModel>? values { get; set; }
protected override async Task OnInitializedAsync()
{
//Mock populating values
values = PopulateValues();
}
private List<ValuesModel> PopulateValues()
{
List<ValuesModel> vals = new List<ValuesModel>();
for (int i = 0; i < 5; i++)
{
vals.Add(new ValuesModel() { Id = i, Name = $"Name {i}" });
}
return vals;
}
}
The API Controller returns a text file to simulate returning a report file.
[Route("api/[controller]")]
[ApiController]
public class ValuesController : ControllerBase
{
// POST api/<ValuesController>
[HttpPost]
public ActionResult Post([FromForm] List<ValuesModel> values)
{
string content = string.Empty;
foreach(ValuesModel v in values)
{
content += $"{v.Id}\t{v.Name}\r";
}
byte[] buff = Encoding.ASCII.GetBytes(content);
return File(buff, "application/octet-stream", "myfile.txt");
}
}
```
Model
```csharp
public class ValuesModel
{
public int Id { get; set; }
public string Name { get; set; } = string.Empty;
}