Hello,
I am using
<SfPdfViewer ServiceUrl="/PdfViewer" DocumentPath="Blazor_Succinctly.pdf" Height="900px">
</SfPdfViewer>
as above.
I want to know how to pass a custom parameter such as a string when the controller method is called to load this file?
Regards,
Amjad.
|
<SfPdfViewer @ref="PdfViewer" ServiceUrl=http://localhost:55767/pdfviewer/parameter DocumentPath="@DocumentPath">
</SfPdfViewer>
|
|
app.UseMvc(routes =>
{
routes.MapRoute("default", "{controller}/{id?}/{action}");
});
public IActionResult Load(string id, [FromBody] Dictionary<string, string> jsonObject){
}
|
Our application is using Endpoint Routing already in various controllers. So when I put your code snippet on the server side, it gives me this error:
"Using UseMvc to congifure MVC is not supported while using Endpoint routing. To continue using UseMvc, please set 'MvcOptions.EnableEndpointRouting=false' inside 'ConfigureServices'"
Regards,
Amjad.
I think I need a sample app that works with the default Blazor Webassembly hosted app.
Thanks,
Amjad.
|
<SfPdfViewer ServiceUrl = "/PdfViewer/parameter" DocumentPath="Blazor_Succinctly.pdf" Height="500px" Width="750px">
</SfPdfViewer>
|
|
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{id?}/{action=Index}");
|
|
[HttpPost("{id}/Load")]
[Microsoft.AspNetCore.Cors.EnableCors("MyPolicy")]
[Route("[controller]/{id}/Load")]
//Post action for Loading the PDF documents
public IActionResult Load(string id, [FromBody] Dictionary<string, string> jsonObject)
{
}
|
Dear Support,
Thank you so much. This works great!
Regards,
Amjad.