control of type 'GridView' must be placed inside a form tag with runat=server Options
nathanp812
Posted: Monday, September 17, 2007 10:32:41 AM
Rank: Newbie

Joined: 9/12/2007
Posts: 8
Hi all,

I have been going around in circles with the implementation of a .NET user control within Umbraco.

Firstly I have created a usercontrol that is a single gridview with codebehind that queries a db and returns results on page load....Nothing new here...

The control works fine outside of Umbraco, yet when I move it into Umbraco and try preview the page I get the following error:

Control 'Cart_2_gvCatalogue' of type 'GridView' must be placed inside a form tag with runat=server.

The code for my Umbraco template is as follows:

Code:
<?ASPNET_FORM>
<?UMBRACO_MACRO macroAlias="Cart" ></?UMBRACO_MACRO>
</?ASPNET_FORM>    


Just for good measure I have also included my markup for the ASP .NET control:

Code:

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="Cart.ascx.vb" Inherits="nathanpowell.ecommerce.Cart" %>

<asp:GridView ID="gvCatalogue" runat="server" AllowPaging="True" AutoGenerateColumns="False"
    GridLines="None" ShowFooter="True">
    <PagerSettings Mode="NumericFirstLast" Position="TopAndBottom" />
    <Columns>
        <asp:TemplateField>
            <HeaderTemplate>
                &nbsp;
            </HeaderTemplate>
            <ItemTemplate>
                <div id="ProductContainer" runat="server">
                    <table>
                        <tr>
                            <td>
                                <asp:Image ID="imageProductImageUrl" runat="server" ImageUrl='<%# bind(container.dataitem,"ProductImageUrl") %>' /></td>
                            <td class="SubHead">
                                <asp:Label ID="lblProductName" runat="server" Text='<%# Bind(container.dataitem,"ProductName") %>'></asp:Label></td>
                        </tr>
                        <tr>
                            <td>
                            </td>
                            <td class="NormalBold">
                                <asp:Label ID="lblDescription" runat="server" Text='<%# Bind(container.dataitem,"Description") %>'></asp:Label></td>
                        </tr>
                        <tr>
                            <td>
                            </td>
                            <td class="Normal">
                                <asp:PlaceHolder ID="PlaceHolderLineItems" runat="server"></asp:PlaceHolder>
                            </td>
                        </tr>
                    </table>
                    <!-- Dynamic Div for product information -->
                </div>
            </ItemTemplate>
        </asp:TemplateField>
    </Columns>
</asp:GridView>


Is there something I am missing here? Are there any additional steps to getting .NET controls to work within the Umbraco framework that I am not aware of?

Any advice would be greatly appreciated, I was under the impression that implementing a .NET user control in Umbraco V3 was supposed to be painless... :hmm:

Thanks in advance.
tim
Posted: Monday, September 24, 2007 9:02:04 PM

Rank: Addict

Joined: 2/19/2007
Posts: 825
Location: Belgium
Does your template have a mastertemplate ? if not maybe it's because you don't have html and body tags. Just guessing

Umbraco tips and tricks: http://www.nibble.be - umbraco mvp 08/09 - certified level 1 & 2 professional
nathanp812
Posted: Tuesday, September 25, 2007 12:37:41 AM
Rank: Newbie

Joined: 9/12/2007
Posts: 8
Hi Tim,

Thanks for the response. I actually solved this issue a few days ago but forgot to post my findings here.

Basically my site is using a master template and I was putting the <?ASPNET_FORM></?ASPNET_FORM> tags into the child template. It turns out that for things to work correctly the Master template needs to have the form tags in it's markup, not in the child template.

Thanks again for your response.

Nathan
Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.