2

I am defining variable css files in head section on my pages (different skins) but can't define them when head has runat="server" (that is there by default) as <%%> is not allowed in runat="server" sections removing runat="server" solves the problem but what is the differece (effect) of having this attribute or not in the head section:

<head>
<title> some title </title>
<link href="<%=skin_common%>.css" rel="stylesheet" />
<link href="<%=skin_color%>.css" rel="stylesheet" />
</head>
Ashkan Mobayen Khiabani
  • 33,575
  • 33
  • 102
  • 171

2 Answers2

2

The only reason the runat attribute is needed in the head section is if your server-side code needs to access it. Outside of that, you can safely remove it.

IrishChieftain
  • 15,108
  • 7
  • 50
  • 91
0

Unfortunately, you will not be able to remove runat="server" if you use Title directive of @Page or set Page.Title in codebehind.

Denis
  • 3,653
  • 4
  • 30
  • 43