Code:
<%@ Page Language="C#" AutoEventWireup="true" Codebehind="XXX.aspx.cs"
Inherits="XXXXXX" ValidateRequest="false" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
<link href="<%=Application["XXXX"]%>/styles/XXXX.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="frmMaintainingChamberReView" runat="server">
<ajaxToolkit:ToolkitScriptManager runat="server" ID="tsm" AsyncPostBackTimeout="600" />
<asp:TextBox ID="text" runat="server" />
<ajaxToolkit:CalendarExtender TargetControlID="text" runat="server" ID="dd" /> --如果不这个去掉的话,就没有问题了。
</form>
</body>
</html>
Inherits="XXXXXX" ValidateRequest="false" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
<link href="<%=Application["XXXX"]%>/styles/XXXX.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="frmMaintainingChamberReView" runat="server">
<ajaxToolkit:ToolkitScriptManager runat="server" ID="tsm" AsyncPostBackTimeout="600" />
<asp:TextBox ID="text" runat="server" />
<ajaxToolkit:CalendarExtender TargetControlID="text" runat="server" ID="dd" /> --如果不这个去掉的话,就没有问题了。
</form>
</body>
</html>
一运行:就报这个错 “控件包含代码块(即 <% ... %>),因此无法修改控件集合。”
问题:
1.是不是<%=Application["WebResourcePath"]%>这种写法与使用ajaxtoolkit控件有冲突?
2.我尝试着把以下的内容,放在一个usercontrol中,然后在进行加载的话,就没有问题?这是怎么回事?我不明白!
“
<link href="<%=Application["XXXXPath"]%>/styles/XXXX.css"
rel="stylesheet" type="text/css" />
<asp:TextBox ID="text" runat="server" />
<ajaxToolkit:CalendarExtender TargetControlID="text" runat="server" ID="dd" />
”
<link href="<%=Application["XXXXPath"]%>/styles/XXXX.css"
rel="stylesheet" type="text/css" />
<asp:TextBox ID="text" runat="server" />
<ajaxToolkit:CalendarExtender TargetControlID="text" runat="server" ID="dd" />
”
解决方案:后台绑定
HtmlHead head = (HtmlHead)this.Page.Header;
HtmlLink htmlLink = new HtmlLink();
htmlLink.Href = Application["WebResourcePath"].ToString() + "/UI/HtlPePageSrc/Style/Common.css";
htmlLink.Attributes["type"] = "text/css";
htmlLink.Attributes["rel"] = "stylesheet";
head.Controls.Add(htmlLink);
HtmlLink htmlLink = new HtmlLink();
htmlLink.Href = Application["WebResourcePath"].ToString() + "/UI/HtlPePageSrc/Style/Common.css";
htmlLink.Attributes["type"] = "text/css";
htmlLink.Attributes["rel"] = "stylesheet";
head.Controls.Add(htmlLink);
相关的问题地址:http://www.experts-exchange.com/Web_Development/WebApplications/Q_23112561.html