Is it possible to make inline code in ASPX markup?

Is it possible to do something in PHPish in ASP.Net? I saw <%= %>, but I tried it and could not get it to work.

The font equivalent of what I want to do is

<script src="<?php echo ResolveUrl("jquery/js/jquery.js"); ?>"></script>
+3
source share
1 answer

Yes, it is quite possible. However, you should familiarize yourself with all variations of the (so-called) alligator tags.

Put the code between the blocks <% %>. The option <%= %>is a shortcut to Response.Writeand is used as a shortcut to directly display the variable on the page.

The following should work if ResolveUrl returns a string. Please note that there is no ";" to complete the line.

<script src="<%= ResolveUrl("jquery/js/jquery.js") %>"></script>
+6

Source: https://habr.com/ru/post/1748067/


All Articles