Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / September 2007

Tip: Looking for answers? Try searching our database.

Edit Buttons in a datagrid

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Iain - 07 Sep 2007 13:04 GMT
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>
Sam - 07 Sep 2007 14:29 GMT
I'm just wondering if it has anything to do with your ItemTemplate?

> Hi All
>
[quoted text clipped - 73 lines]
> </asp:datagrid>
>       </form>
ThatsIT.net.au - 07 Sep 2007 14:29 GMT
you need a runat="server" in your form

> Hi All
>
[quoted text clipped - 73 lines]
> </asp:datagrid>
>       </form>

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.