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 the page, I get the following error
MultiView cannot have children of type 'GridView'. It can only have children of type View.
I've collapsed the Multiview code and the only two children it has are the views. Is it complaining because of the contents of the view? Because otherwise that'd make it almost completely useless.
How do I fix this?
I was getting the exact error, but in my case I had forgotten to set runat="server"
in the View control.
If one doesn't include runat="server"
then that control simply doesn't exist for the backend. I hope this helps.
This error means you have something outside your view tag. I.e. you have an asp element(other than view) in the multiview tag directly instead of being in the view tag.
Make sure you do not have a gridview in the multiview outside a view tag.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With