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"/> -- if this is not removed, no problem is found.
</Form>
</Body>
</Html>
When you run the command, the following error is reported: "The control contains a code block (that is, <%... %>). Therefore, the control set cannot be modified ."
Problem:
1. Is this statement <% = Application ["WebResourcePath"] %> in conflict with the ajaxtoolkit control?
2. I try to put the following content in a usercontrol, and then load it, there is no problem? What's going on? I don't understand!
"
<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"/>
"
Solution: bind the backend
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 );
Problem address: http://www.experts-exchange.com/Web_Development/WebApplications/Q_23112561.html