I would like to add a little variation to the path of my css link each time my Site.Master view is processed. What is the right way to do this? My code is currently breaking into Default.aspx, saying that I did not define cssLink. Site.Master below:
<script runat="server">
void Page_Load(object sender, EventArgs e)
{
string cssLoc = "../../Content/css/expect.css?t=" + DateTime.Now.Ticks.ToString();
string cssLink = String.Format(@"<link rel=""stylesheet"" type=""text/css"" href=""{0}"" />", cssLoc);
}
</script>
<!DOCTYPE html>
<html>
<head id="Head1" runat="server">
<asp:ContentPlaceHolder ID="head" runat="server">
<title></title>
</asp:ContentPlaceHolder>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<%= cssLink %>
<script type="text/javascript" src="../../Scripts/jquery.js"></script>
</head>
Also, is there anyway the correction of the message "XHTML transitional, Title is too few times"?
UPDATE:
Please ignore the problem with scoping. See Richard's answer. However, I must note that fixing this does not solve the problem.
I think because of the declaration Inherits = "System.Web.Mvc.ViewMasterPage" the whole file Block is <script runat="server">
not processed.