ASP.NET using class(static methods) in .aspx design form's head section -
basically trying integrate foundation 4 framework asp.net project. have made class in app_code have made static methods contains css, js links. want use in head tags in .aspx file. partial code: appcore.cs
public class appcore { private static idictionary<string, string> dlink = new dictionary<string, string>(); static appcore() { //app links dlink.add("js", "~/_assets/js/"); dlink.add("css", "~/_assets/css/"); dlink.add("img", "~/_assets/img/"); } public static string link(string i) { if (!dlink.containskey(i)) return "n/a"; else return dlink[i]; } }
i able use inside body tags as
<% appcore.link("css")+"foundation.css";%>
what want use in head like:
<link rel="stylesheet" href="<% appcore.link("css");%>foundation.css" />
where failing?
try this
<link rel="stylesheet" href="<%= appcore.link("css") %>foundation.css" />
put =
sign after <%
, remove ;
end.
for client specific url this
<link rel="stylesheet" href="<%= resolveclienturl(appcore.link("css")) %>foundation.css" />
Comments
Post a Comment