-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Java Script UI is not working in Blazor Server App #22908
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
If you navigate away from the page and then back, does it stop working again? |
Just to clarify: The navigation back and forth of the Page isn't resolving the issue, obviously. I stuck with my project because of this issue. |
When you change it so that it works. If you navigate away from the page and then back again, is it now broken again? |
If the DateTimePicker works and I navigate away from the page and then back again - it's still working. |
I really wasn't expecting that answer :) Would you like to send me a small project that reproduces the problem and I'll have a look? |
Here you go. |
@const1966 thanks for contacting us. Your issue is that Blazor hasn't finished loading by the time you run your script. The proper way to achieve what you are trying to accomplish is to define a function in the global scope and call it from OnAfterRenderAsync using JS interop. See here for details. |
Hi Javier, Your suggestion does makes sense but I'm having issue with an implementation of one.
I'm calling this function as you suggested:
But the issue is still there - DateTimePicker is not working. Please advise |
@const1966 The casing is wrong
|
Thank you Javier, but this doesn't work even after I fixed the casing. |
Hello,
I'm having problem with an implementation of any of JS UI (say DateTimePicker) in Blazor Server Side app ( .NET Core 3.1 Framework).
Dev Env: Microsoft Visual Studio Professional 2019
Version 16.5.4
Microsoft .NET FRamework 4.7.03062
I just want to have DateTime Picker on my Index.razor page:
Here is my _Host.cshtml:
The issue I'm facing is when "blazor.server.js" reference is sitting within the
<body>
tag(where this is actually supposed to be), my "orderDatePicker" is not working (not showing Dates to pick).
But when I move
from
<body>
to<head>
the Picker works perfectly:Looks like my problem is resolved, but the new and bigger issue appears as a result of that move.
Exactly, onclick event is stopping to work on Counter.razor page:
The Counter doesn't work while this worked well before the move.
Could anybody explain me why this is happening.
Thank you.
The text was updated successfully, but these errors were encountered: