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

183
Vistas
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 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