Edit Buttons in a datagrid

I

Iain

Hi All

I have an ASP:EditCommandColumn and a ASP:ButtonColumn, both of which
are within a datagrid and this in turn is inside a Form tag (See code
below). When I run the app i get the message

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

The datagrid/button definition was copied from another web application
which had no problems.

Can anyone please enlighten me on where I am going wrong.

Amy help gratefully accepted. Many thanks in advance for any
assistance offered

Iain

----------------------------------------------------------------------------------------------------------

<form>
<asp:datagrid id="PageImages" runat="server" borderstyle="Solid"
bordercolor="#C0FFFF"
oncancelcommand="PageImages_CancelCommand"
onupdatecommand="PageImages_UpdateCommand"
oneditcommand="PageImages_EditCommand"
ondeletecommand="PageImages_DeleteCommand"
OnItemDataBound="PageImages_OnItemDataBound"
onsortcommand="PageImages_SortCommand"
cellpadding="2"
font-size="8pt"
autogeneratecolumns="false"
headerstyle-font-bold="true" itemstyle-
verticalalign="top"
enableviewstate="true" allowsorting="True">
<EditItemStyle borderstyle="Dashed" bordercolor="#0000C0"
backcolor="#FFFFC0">
</EditItemStyle>
<ItemStyle verticalalign="Top">
</ItemStyle>
<HeaderStyle font-bold="True" horizontalalign="Center"
borderwidth="1px" forecolor="White"
borderstyle="Double" bordercolor="Red" backcolor="Black">
</HeaderStyle>
<Columns>
<ASP:EditCommandColumn buttontype="PushButton"
updatetext="Update"
headertext="Edit"
canceltext="Cancel"
edittext="Edit">
</ASP:EditCommandColumn>
<ASP:ButtonColumn text="Delete"
buttontype="PushButton"
headertext="Delete"
commandname="Delete">
</ASP:ButtonColumn>
<ASP:BoundColumn datafield="ImageName" headertext="Image Name"></
ASP:BoundColumn>
<ASP:BoundColumn datafield="ImageText" headertext="Image text"></
ASP:BoundColumn>
<ASP:BoundColumn datafield="AlternateText" headertext="Alternate
text"></ASP:BoundColumn>
<ASP:BoundColumn datafield="HRef" headertext="Internet Address
(URL)"></ASP:BoundColumn>
<ASP:BoundColumn datafield="Sequence" headertext="Display
Sequence"></ASP:BoundColumn>
<ASP:BoundColumn datafield="Published" headertext="Published"></
ASP:BoundColumn>
<asp:TemplateColumn HeaderText="Image">
<ItemTemplate>

</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid>
</form>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,708
Messages
2,569,346
Members
44,650
Latest member
LuckyVivo

Latest Threads

Top