ASP.net错误:Control 'ctl00_ctl00_ContentPlaceHolder2_ContentPlaceHolderRight_ListView1_ctrl0_DeleteButton' of type 'Button' must b

表现:

当然也可能是另外一个什么控件必须放置在Form里边。

 

原因:

如果是普通情况,当然直接加一个Form就可以了,但如果是使用了master page,这个错误的真正原因是在master page中 ContentPlaceHolder被错误放置到<form>外面了:

 

    <form id="form1" runat="server">
    <asp:LinkButton ID="PB" runat="server"><b>P</b>roduct Backlog</asp:LinkButton>
    <asp:LinkButton ID="SB" runat="server"><b>S</b>print Backlog</asp:LinkButton>
    </form>

    <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
    </asp:ContentPlaceHolder>
    <asp:ContentPlaceHolder id="ContentPlaceHolder2" runat="server">
    </asp:ContentPlaceHolder>

 

改为:

 

    <form id="form1" runat="server">
    <asp:LinkButton ID="PB" runat="server"><b>P</b>roduct Backlog</asp:LinkButton>
    <asp:LinkButton ID="SB" runat="server"><b>S</b>print Backlog</asp:LinkButton>

    <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
    </asp:ContentPlaceHolder>
    <asp:ContentPlaceHolder id="ContentPlaceHolder2" runat="server">
    </asp:ContentPlaceHolder>
    </form>

一切正常。

posted @ 2010-02-10 10:01  我的一天  阅读(108)  评论(0编辑  收藏  举报