Shantanu Gupta
Shantanu Gupta

Reputation: 21198

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

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

Upvotes: 4

Views: 15523

Answers (1)

SLaks
SLaks

Reputation: 887459

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.

Upvotes: 15

Related Questions