Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

<link rel="Stylesheet" type="text/css" href="<% ResolveUrl("~/Css/test.css") %>"/>

Tags:

c#

asp.net

Error   5   ; expected  

<link rel="Stylesheet" type="text/css" href="<% ***ResolveUrl("~/Css/test.css");***  %>"/>

Do i need to give ; over here as my solution is not still working it starts giving some other error

like image 353
Shantanu Gupta Avatar asked Dec 07 '22 05:12

Shantanu Gupta


1 Answers

You need to add an equals sign, like this:

<link rel="Stylesheet" type="text/css" href="<%= ResolveUrl("~/Css/test.css") %>"/>

Explanation:

<% %> blocks insert entire statements or blocks into the generated function. If you want to declare a variable, start a loop, or run a stand-alone statement, use a <% %> block. The code in the block must be a complete statement; it gets inserted in the middle of the method.

<%= %> blocks evaluate an expression and print the result; use them when you want to call a method or read a variable and output the result. The code in the block must be an expression; it turn into an argument for a method call.

like image 135
SLaks Avatar answered Dec 10 '22 03:12

SLaks