How to use jCrop in ASP.Net Blazor server side
Asked Answered
T

1

6

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..

Tomato answered 17/2, 2020 at 4:47 Comment(1)
Hey learning, have you tried this -> social.technet.microsoft.com/wiki/contents/articles/… . I know its mvc 5 but similar technique can be used for core or blazor.Florrie
C
5

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.

Concomitance answered 16/4, 2020 at 6:13 Comment(4)
@matham, Yes that is fine but it makes adding such plugin bit difficult or complex in a way if you agree, i was looking for 1 such example which would show such scenarios as you know you for website development with Blazor these plugin are going to be backbone and if integration with be difficult then people may shy away from using it for such projectsTomato
@Tomato some how I agree with your point of difficult, but I have same dilemma by choosing a new JavaScript framework or use C# which I already know in Blazor of course it depends on your project scope, team size, team knowledge etc. IMO the upside of using Blazor for me is 1. using C# syntax 2. debugging 3. reusable components. Down side right now is not all existing JavaScript library out there are out of the box compatible with it, but I see a lot of developers doing features for Blazor. it is matter of time.Concomitance
@Tomato there are different projects, but for example Blazorise is a bootstrap example if you check how they did use chart.js in Blazor you will get some practical ideas on how others could be implemented (blazorise.com/docs/extensions/chart)Concomitance
I am one man team and its very difficult to at times to focus on all or to be a subject expert... Blazor is new and i have hope as lot of people have started contributing it and taking interest in it for now i think its not a good choice for partime grammer or intermediate programmers and it needs level of expertise if you want to do development otherwise i am a .net fan but for this question i have to wait for weeks to get response.. if we had lot of people with such experience definitely they would have replied..Tomato

© 2022 - 2024 — McMap. All rights reserved.