错误消息,“控件集合无法修改,因为控件包含代码块”

时间:2010-04-16 09:20:43

标签: asp.net user-controls umbraco

我在以前工作正常的页面上收到此错误,事实上我最近对该页面所做的唯一更改是添加另一个asp:TextBox和asp:RequiredFieldValidator控件。

页面上已经有很多ASP.NET控件,所以我看不出为什么这些额外的控件会产生影响,无论如何我会发布下面的代码,希望你能看到错误是什么:

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="MeetingGenerator.ascx.cs" 
Inherits="usercontrols_MeetingGenerator" %>

<%@ Register TagPrefix="cc1" Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" %>

<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<div style="width:498px;height:425px;background-color:#033b2a;text-align:center;padding-top:20px;">    

    <asp:Label ID="lblDone" CssClass="done" runat="server"></asp:Label>

    <asp:Panel id="pnlAddReport" runat="server">
    <div>
        <img src="../images/banners/add-meeting.png" alt="Add Report" />
    </div>
    <p>

    <asp:ValidationSummary ID="ValidationSummary"  CssClass="validationsummary" runat="server" />
        <asp:TextBox ID="txtTitle" BorderStyle="None" CssClass="watermark" 
            Width="250px" Height="22px" runat="server"></asp:TextBox>
        <cc1:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender1" TargetControlID="txtTitle" WatermarkCssClass="watermark"
             WatermarkText=" Meeting title" runat="server"></cc1:TextBoxWatermarkExtender>
        <asp:RequiredFieldValidator ID="rfvTitle" ControlToValidate="txtTitle" Text=""
             ErrorMessage="Please enter the title" Display="None" 
             InitialValue="" runat="server"></asp:RequiredFieldValidator>
        <asp:RequiredFieldValidator ID="rfvTitle1" ControlToValidate="txtTitle" Text=""
             ErrorMessage="Please enter the title" Display="None" 
             InitialValue=" Meeting title" runat="server"></asp:RequiredFieldValidator>
    </p>

    <p>
        <asp:TextBox ID="txtDate" BorderStyle="None" CssClass="watermark" 
            Width="250px" Height="22px" runat="server"></asp:TextBox>
        <cc1:CalendarExtender ID="ceDate" TargetControlID="txtDate" Format="dd/MM/yyyy" runat="server">
            </cc1:CalendarExtender>
        <cc1:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender2" TargetControlID="txtDate" WatermarkCssClass="watermark"
             WatermarkText=" Meeting Date" runat="server"></cc1:TextBoxWatermarkExtender>
        <asp:RequiredFieldValidator ID="rfvDate" ControlToValidate="txtDate" Text=""
             ErrorMessage="Please select the meeting date" Display="None" 
             InitialValue="" runat="server"></asp:RequiredFieldValidator>
        <asp:RequiredFieldValidator ID="rfvDate1" ControlToValidate="txtDate" Text=""
             ErrorMessage="Please select the meeting date" Display="None" 
             InitialValue=" Meeting Date" runat="server"></asp:RequiredFieldValidator>
    </p>

    <p>
        <asp:TextBox ID="txtMeetingTime" BorderStyle="None" Width="250px" Height="22px" MaxLength="5"
             runat="server"></asp:TextBox>
        <cc1:TextBoxWatermarkExtender ID="tweMeetingTime" TargetControlID="txtMeetingTime" WatermarkCssClass="watermark"
             WatermarkText=" Time (HH:MM)" runat="server"></cc1:TextBoxWatermarkExtender>
        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="txtMeetingTime" Text=""
             ErrorMessage="Please enter the meeting time" Display="None" 
             InitialValue="" runat="server"></asp:RequiredFieldValidator> 
    <asp:RequiredFieldValidator ID="RequiredFieldValidator11" ControlToValidate="txtMeetingTime" Text=""
             ErrorMessage="Please enter the meeting time" Display="None" 
             InitialValue=" Time (HH:MM)" runat="server"></asp:RequiredFieldValidator>    
    </p>

    <p>
        <asp:TextBox ID="txtLocation" BorderStyle="None" CssClass="watermark" 
            Width="250px" Height="22px" runat="server"></asp:TextBox>
        <cc1:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender3" TargetControlID="txtLocation" WatermarkCssClass="watermark"
             WatermarkText=" Location" runat="server"></cc1:TextBoxWatermarkExtender>
        <asp:RequiredFieldValidator ID="rfvLocation" ControlToValidate="txtLocation" Text=""
             ErrorMessage="Please enter the location" Display="None" 
             InitialValue="" runat="server"></asp:RequiredFieldValidator>
        <asp:RequiredFieldValidator ID="rfvLocation1" ControlToValidate="txtLocation" Text=""
             ErrorMessage="Please enter the location" Display="None" 
             InitialValue=" Location" runat="server"></asp:RequiredFieldValidator>
    </p>

    <p>
    <asp:ImageButton ID="btnAddMeeting" ImageUrl="/images/buttons/addmeeting-btn.gif" runat="server" OnClick="btnAddMeeting_Click" />

    </p>

    <p>

    </p>
    </asp:Panel>
</div>

<%@ Master Language="C#" MasterPageFile="/masterpages/Master.master" AutoEventWireup="true" %>

<asp:content ContentPlaceHolderId="additionalhead" runat="server">

</asp:content>

<asp:content ContentPlaceHolderId="additionalbody" runat="server">
    <umbraco:Macro Alias="AddMeeting" runat="server"></umbraco:Macro>   
</asp:content>

<asp:content ContentPlaceHolderId="bodyContent" runat="server">

</asp:content>

<%@ Master Language="C#" AutoEventWireup="true"  %>

<!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><umbraco:Item field="title" runat="server"></umbraco:Item></title>

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"></script>
    <script type="text/javascript" src="/js/jQueryString-2.0.2-Min.js"></script>

    <link rel="stylesheet" type="text/css" href="/css/Styles.css" />
    <link rel="stylesheet" type="text/css" href="/css/Layout.css" />
    <link rel="stylesheet" type="text/css" href="/css/Forms.css" />


    <script type="text/javascript" language="javascript">
        $(document).ready(function () {
            $('#uploadAgenda').hide();
            $('#uploadMinutes').hide();
            $('#<%=txtSearchEAA.ClientID%>').val('Search EAA');

            var st = $.getQueryString({ ID:"search" });
            if (st != '') {
                $('#<%=txtSearchEAA.ClientID%>').val(st);
            };

            $('#<%=txtSearchEAA.ClientID%>').click(function() {
                $('#<%=txtSearchEAA.ClientID%>').val('');
            });
        });
    </script>

    <script type="text/C#" runat="server">
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            Response.Redirect("/members/search-results?search=" + txtSearchEAA.Text);
        }
    </script>


    <asp:ContentPlaceHolder id="additionalhead" runat="server"></asp:ContentPlaceHolder>
    <umbraco:Item field="AdditionalHead" runat="server"></umbraco:Item>
</head>
<body style="background-color:#e5e5e5;">

<script runat="server">
protected void btnLogout_Click(object sender, EventArgs e)
{
    FormsAuthentication.SignOut();
    Response.Redirect("/login");
}
</script>

    <form id="form1" runat="server">
    <asp:ContentPlaceHolder id="additionalbody" runat="server"></asp:ContentPlaceHolder>
        <div class="wrapper">
            <div class="content">
                <div class="banner">
                    <div class="bannerSearchSpacer">
                        <a href="/home"><h1><span>EAA</span></h1></a>
                    </div>  

            <div class="aboutEAA">
                &nbsp;
            </div>

            <div class="bannerSearchAligns">
                        <div class="searchbox">
                                <asp:TextBox ID="txtSearchEAA" CssClass="watermark"
                        Width="155px" runat="server"></asp:TextBox>
                        </div>
                        <div class="searchButton">
                                <asp:ImageButton ID="imbSearch" ImageUrl="/images/buttons/go.gif" OnClick="btnSearch_Click" runat="server" />
                        </div>
                    <div style="clear:both;"></div>
                    </div>

            <div class="loginBox">
                        <dl>
                    <dt>Hello</dt>
                    <dd><umbraco:Macro Alias="MemberName" runat="server"></umbraco:Macro></dd>
                    <dt>Arena</dt>
                    <dd><umbraco:Macro Alias="MemberArena" runat="server"></umbraco:Macro></dd>
                </dl>
                <div><asp:ImageButton ID="btnLogout" ImageUrl="/images/buttons/logout.gif" runat="server" OnClick="btnLogout_Click" /></div>
                    </div>
            <div style="clear:both;"></div>
        </div>



       <div id="contentarea">
            <div class="menuLeft">                
                <div class="menuPlaceholder">
                    <umbraco:Macro Alias="DynamicMenu" runat="server"></umbraco:Macro>
                </div>
            </div>  
                <div class="mainBody">
                    <asp:ContentPlaceHolder id="bodyContent" runat="server"></asp:ContentPlaceHolder>
                </div>

                <div style="clear:both;"></div>
            </div>
        </div>
    </div>

    </form>



<umbraco:Macro Alias="MemberAnalytics" runat="server"></umbraco:Macro>



</body>
</html>

2 个答案:

答案 0 :(得分:0)

尝试在jQuery脚本中更改&lt;%= to&lt;%#。查看this article

答案 1 :(得分:0)

它是通过从jQuery选择器中删除代码块并将它们更改为name * = selectors来进行排序的。将&lt;%=更改为&lt;%#并没有解决问题,希望选择器更改适用于其他人。