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

211
Visualizações
How to insert ASP.NET tag to JS

I need include a lot of ASP.NET condition into my JS, for example

<% if (Boolean.Parse(System.Configuration.ConfigurationManager.AppSettings["DebugOutput"])) %>
<% { %>
else if (window.location.href.includes("Test1.aspx")) {
    checkpanelsize();
    if (Cookies.get('lm') == '1') {
        $("#lftest").addClass("current");
    }
    else if (Cookies.get('lm') == '0') {
        $("#lstest").addClass("current");
    }
}
<% } %>

In other case I need export some function from this JS module, so I need place this JS module to separate JS file in order to export some function from this JS module with ASP.NET condition.

I expected that If I rename JS to .ASPX and include my module in the same way

<script type="text/javascript" src="Controls/LeftMenuJS.aspx"></script>

than ASP.NET condition in JS module will be working. But unfortunately no. Browser said me "Loading failed for the with source “http://localhost:9020/Controls/LeftMenuJS.aspx”."

JS file (wrapped in ASPX extension) is present in project directory, I can click to browser message and see my JS script packed to ASPX, but ASP.NET tags don't working.

enter image description here

How is possible to solve this problem? In this project I use ASP.NET Classic with NET Framework.

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