113 questions
0
votes
0
answers
38
views
Blazor JSinterop invokeMethodAsync on blur event is affecting js component behavior
I've modified a Blazor-JS component based on QuillJs to enable two-way binding from the text editor to blazor/c# property
I've done this by adding a 'blur' event listener and invoking a method c# ...
0
votes
1
answer
91
views
Blazor JS Interop // javascript window events and functions not working
In a Blazor MAUI Hybrid app, I am trying to save the scroll position per page so that if returning to the page the saved scroll position is then reapplied.
I know that I should be saving it in session ...
0
votes
0
answers
64
views
"using Microsoft.JSInterop;" causes the side effects?
The official example of JavaScript interop functionality for RazorClassLibrary-CSharp template:
using Microsoft.JSInterop;
namespace Company.RazorClassLibrary1;
public class ExampleJsInterop : ...
0
votes
0
answers
57
views
Confusion About .NET to JavaScript Interoperability in Blazor - Method Call Sequence
I'm working on a Blazor project where I need to call a .NET method from JavaScript, but I'm encountering some confusion with the sequence of method calls. Here’s a simplified version of my code:
@page ...
1
vote
0
answers
102
views
Blazor/Maui Function JS is undefined
I'm in a blazor/Maui project with JSInterop.
My function is in a script in the index.html file, other functions are called correctly there.
In the case of an instant discussion, I want the message ...
0
votes
0
answers
372
views
How to know when an anchor tag (<a>) file download has finished?
I have a Blazor-Server application that has file downloads on a page.
When the user downloads a large file (>250MB), it is temporarily created in a physical path in the Server, gets downloaded and ...
-1
votes
1
answer
52
views
JSInterop returns function not defined
I am trying to call JS functions from C# using JS Interop. I have defined two methods and then calling using InvokeVoidAsync.
The problem is in browsers like edge and firefox the there comes error ...
0
votes
1
answer
442
views
How to get BUnit JSInterop?
According to the BUnit documentation this should be available by default.
But in my Unit test Microsoft.JSInterop is a namespace, not a class where Setup can be called on. I've also tried ...
1
vote
1
answer
143
views
Deserializing JSON to an object - Whole object not being deserialized
I am receiving and object from a JS calendar via JSInterop in Blazor. I have a C# interface and class that represents the JS object. A few properties are not being deserialized. In Particular the End ...
0
votes
1
answer
272
views
Should I use IJsInProcessRuntime or [JSImport] API for "regular javascript interop calls?
I asked this on aspnetcore GH but it seems like a quite dead forum so I'm trying my luck here...
We just migrated our .NET 6 code base to .NET 8 and I am familiarizing myself with what we can do in ...
1
vote
3
answers
983
views
Return a list of JSObjectReference in Blazor using JS Interop
Is it possible to return a list of object references from JS to C#? Currently I do return a list of objects (THREE.js objects) though I am unable to deserialize it into a C# IList or array to get ...
0
votes
0
answers
645
views
Blazor JS Interop - What is faster, many small JS interops or fewer large ones?
The title pretty much says it all.
I am looking to improve performance in our blazor app which does a lot of JS interoping to JS code for making use of THREE.js API. I understand that the calls have ...
0
votes
1
answer
522
views
Blazor server can't find Javasccript file
This is driving me nuts and I'm sure I'm missing something simple because I have zero JS experience. I'm trying to call a js function from the code-behind of a razor page. I keep getting an error it ...
1
vote
1
answer
3k
views
Bootstrap modal on Blazor stopped working on .NET 8 RC2 (using JSInterop to open/close)
I believe what I'm doing is against the dotnet-8-Blazor-way of doing things, but I'll post anyway as I feel that if more people have done until .NET 7 what I did, this will be useful for them.
...
0
votes
1
answer
610
views
Blazor Server app - JS Interop call within a reusable component not working when multiple components on screen
I have a javascript event I need to listen for (kicked off by an outside vendor library) and then act on that inside of my component by hiding some content when that event is fired. I've gotten it ...
0
votes
1
answer
746
views
Calling Method from JS Dotnet Maui Blazor App
Hello All,
I can implement google map into Maui Blazor app. with following codes: How to retrieve strCoord to OnCenterChanged Method from JS function. Please help...
I added following codes to index....
0
votes
1
answer
750
views
Why isn't Blazor able to find a JavaScript function declared in index.html?
I am trying to call a JavaScript function in a .razor component:
This is what it's been declared like in index.html:
window.getIsBrowserChromium = function () {
return !!navigator.userAgentData &...
0
votes
0
answers
465
views
Blazor + JSInterop for media recording
I am building a web app which allows users to record short audios < 20 seconds. I wrote some code and it works, but only if the audio is stopped when it's shorter than 3-4 seconds.
It's a C#, ...
0
votes
1
answer
333
views
Blazor wasm JS Interop serialization
I am trying to serialize any type in JS to object in C#, and nothing seems to work.
I have a property on my EventAction
public DotNetObjectReference<EventAction<T>> DotNetObjRef { get; }
...
3
votes
0
answers
151
views
Blazor Java script interop
I have this javascript library that is written in TypeScript
(function(f) {
if (typeof exports === "object" && typeof module !== "undefined") {
module.exports = ...
1
vote
1
answer
930
views
Get user geo-location in Blazor with JSInterop
I'm trying to get the user's city location, but first I want to try coordinates, as I find this hard enough already.
I have this javascript (from another post) but changed the return value;
<script&...
0
votes
0
answers
457
views
MicrosoftTeams context not shared between js and js interop in Blazor app - The library has not yet been initialized
I'm working on a Blazor app that runs embedded inside Microsoft Teams. In order to interact with Teams, we use the Teams SDK and call it from our C# code using the IJSRuntime interface. In order to do ...
0
votes
1
answer
698
views
Blazor - How to Call Independent JSInterop Methods Located on Layout and Child Components
Up until the day before this post was first made, I have been calling JSInvokable methods just fine from any page loaded in the app. I was creating and establishing the the DotNotObjectReference ...
1
vote
0
answers
238
views
MemoryView as a return parameter from Javascript to Blazor
Part 3 of multiple questions (here part 2: MemoryView utilization with latest JSImport API syntax to interop with Javascript - Blazor)
I'd like to find a solution to receiving RETURNed Task values (or ...
0
votes
2
answers
2k
views
Blazor: Set focus on an element not work after submit
this code when submit button entered invoked.
in "finally" i want to set focus to an InputText but it doesn't work.
private async Task SubmitBtn()
{
if (_busy_submit_btn) return;
...