MultiView cannot have children of type "GridView". He can only have children of type View.

I have the following asp.net code

asp:MultiView runat="server" ID="mvPaymentsOnProperty" ActiveViewIndex="0">
    <asp:View runat="server" ID="vPaymentsMadeOnProperty">
        <br />
        <asp:GridView runat="server" ID="gvPaymentsMadeOnProperty" AutoGenerateColumns="false" EmptyDataText="bla bla">
            <Columns>
                <asp:BoundField HeaderText="bla" DataField="bla" />
                <asp:BoundField HeaderText="foo" DataField="bar" />
            </Columns>
        </asp:GridView>
    </asp:View>
    <asp:View runat="server" ID="vNoPaymentsMadeOnProperty">
        Some sort of error
    </asp:View>

</asp:MultiView>

When I try to load a page, I get the following error

MultiView cannot have children of type "GridView". It may have children of type View.

I destroyed the Multiview code, and it has only two children. Does this complain about the content of the submission? Because otherwise it is almost completely useless.

How to fix it?

+3
source share
2 answers

I was getting the exact error, but in my case I forgot to set the runat="server"View in the control.

runat="server", . , .

+5

, - . asp ( ) multiview , view.

, gridview .

+2

All Articles