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

192
Vistas
Convert in JavaScript C# code that reads from web.config

in the web.config file of my ASP.NET MVC application I have some constant string values. sommething like this:

<add key="filters" value="AA;BB;CC;DD" />

In a C# file I create a List in this way:

List<string> filters = new List<string>(ConfigurationManager.AppSettings["filter"].Split(new char[] { ';' }));

Now I have to put this code in a JavaScript file and create as many string variables as strings are present in this List.

For example, in this case I should obtain:

filterAA filterBB filterCC filterDD

How can I accomplish this task?

Thank you in advance.

Luis

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You can add List to a view model in a controller, then you sent the data to View via ViewModel. Add this code inside of View

@model ViewModel

... your html code

<script>

   var filters = @Html.Raw(Json.Serialize(@Model.Filters));
 
 </script>
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