AjaxToolKit-problem, Solution

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.