I have used JCrop almost in all of my ASP.Net webform projects and its very handy tool and moving forward i have to start using ASP.Net Core or ASP.Net Blazor for new project and also to upgrade old webform based projects.
I am testing different things in blazor before i start upgrading and one of the things which i am finding difficult is how to use j Crop in blazor. i have used jCrop in a similar was as showing in this tutorials for webform projects.
https://www.c-sharpcorner.com/blogs/how-to-crop-image-and-save-the-cropped-image-using-asp-net-jquery
I have looked of example on net but couldn't find much i need a pointer to move forward..
Per default, it is not possible to run JavaScript out of the box in Blazor regarding Microsoft:
For Blazor Server apps with prerendering enabled, calling into JavaScript isn't possible during the initial prerendering. JavaScript interop calls must be deferred until after the connection with the browser is established. For more information, see the Detect when a Blazor Server app is prerendering section.
And to run JavaScript in Blazor:
A Blazor app can invoke JavaScript functions from .NET methods and .NET methods from JavaScript functions. These scenarios are called JavaScript interoperability (JS interop).
You can thus, make some manipulation to solve that. Please check Call JavaScript from .NET.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With