Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

207
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda