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

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

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