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

184
Visualizações
How to pass values from C# to JavaScript using MVC?

I am working on a progress bar to update the user experience when we request data from the server. I have a Bootstrap progress bar that is updated it from JavaScript. I want pass the progress of the bar by passing the value from C# code. Here is what I have so far:

This is the HTML file:

<div class="progress">
    <asp:HiddenField ID="hdnfldVariable" runat="server" />
    <div class="progress-bar" role="progressbar" style="width: 0;" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div>
</div>

This is the JavaScript File:

//Progress Bar
var progressBar = $('.progress-bar');
var progressNumber = "Here will go value from C# file";

setInterval(function () {
progressBar.css('width', progressNumber + '%');
progressBar.attr('aria-valuenow', progressNumber);
}, 100)

This is the C# value that I want to pass:

   public int progressBarPercentage;
   
   //listPrices.Count is List that updates when we request information from the server
   progressBarPercentage = listPrices.Count;

I try to use "<%=progressBarPercentage%>" but is not working, there is any other approach to this. Thank you

about 4 years ago · Juan Pablo Isaza
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