Every time I put the inline tag in the link href attribute, it is somehow automatically encoded. Is this the default behavior of ASP.NET? How can I dynamically set the HREF attribute using code? This is in MVC.
Trying something like this
<link href="<%: Link.Content.Jquery_css %>" rel="stylesheet" type="text/css" />
who did it (nothing has changed)
<link href="<%: Link.Content.Jquery_css %>" rel="stylesheet" type="text/css" />
and this one
<link href="<%= Link.Content.Jquery_css %> rel="stylesheet" type="text/css" />
which produced this (I couldn't remember the exact numbers, but it seems that the parentheses-percent-equal were encoded to refer to the format)
<link href="/View/Shared%25Link.Content.Jquery_css%25" %>" rel="stylesheet" type="text/css" />
Link.Content.Jquery_css - A strongly typed string containing a link created using T4MVC.
Add-on Information: I used ASP.NET MVC 2 in .NET 4 and testing in Firefox.
source
share