Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

204
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!