C
C#7mo ago
Adam

Error CS0103

I am trying to follow this tutorial: https://learn.microsoft.com/en-us/training/modules/blazor-build-rich-interactive-components/2-create-user-interfaces-blazor-components?ns-enrollment-type=learningpath&ns-enrollment-id=learn.aspnet.build-blazor-webapps and I am getting error CS0103 when trying to use <div @ref="placeHolder"></div> so that "...Blazor render tree doesn't attempt to track its contents. " and I can use the DOM to act on the div.
JavaScript interoperability with Blazor - Training
Learn about Blazor JavaScript interoperability, loading JavaScript in Blazor, calling JavaScript from .NET, and calling .NET from JavaScript.
3 Replies
SleepWellPupper
SleepWellPupper7mo ago
You likely don't have a variable to assign the element reference to. Check out this tutorial on the matter: https://blazor-university.com/javascript-interop/calling-javascript-from-dotnet/passing-html-element-references/
SleepWellPupper
SleepWellPupper7mo ago
As you can see in the first code example, you need a ElementReference variable as well
FusedQyou
FusedQyou7mo ago
Please share actual context instead of this. This doesn't explain anything Share the full error, and share the code the error references. The stacktrace will mention the file + line at the top. Share as much as possible of this file.
Want results from more Discord servers?
Add your server