Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

204
Vistas
How to call blazor onclick method with static render mode

How to call onclick method while rendering component as a static html? I mean, is there any workarounds in JavaScript?

@(await Html.RenderComponentAsync<Awesome>(RenderMode.Static))

And the Awesome.razor

<h3>@name</h3>

<button @onclick="@(() => name = name.ToUpper())">Upper case me</button>

@code {
    string name = "Mr. Blazor";
}

While using ServerPrerendered it seems to work because oninitialize method is fire, but again onclick doesn't work.

@(await Html.RenderComponentAsync<Awesome>(RenderMode.ServerPrerendered))
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Like the docs say:

Static : Renders the component into static HTML

That means an @onclick will never work, nor anything else in written in C#.

is there any workarounds in JavaScript?

JavaScript will still work, use onclick (without the @). But that won't let you use this name variable.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda