Solved

Adding Button to EditCommandColumn on a dtatagrid footer

Posted on 2004-10-20
3
482 Views
Last Modified: 2012-05-05
Hello all,

What I would like to do is have a databound datagrid on a asp page using c#. This will allow editing and the insertion of new data. I have an EditCommandColumn with the normal edit cancel and delete options defined. All the other columns are template types with a footer defined to hold the fields for the user to create the new row in.

The problem I have is that I need to add a ‘add‘ or submit button to the footer of the EditCommandColumn, is this possible, if so how is it done? I keep getting parse erros if I try the following:-

<asp:EditCommandColumn ButtonType="PushButton" UpdateText="Update" CancelText="Cancel" EditText="Edit">
                              <FooterTemplate>
                                    <asp:LinkButton id="LinkButton1" runat="server">LinkButton</asp:LinkButton>
                              </FooterTemplate>
                        </asp:EditCommandColumn>
0
Comment
Question by:kplonk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 3

Expert Comment

by:Realmrat
ID: 12367252
I don't think a Column has a "footer".  The footer is defined for the whole datagrid.  Move the footer code outside the column code and that will probably solve your parse errors.

Ex:

                     <asp:EditCommandColumn ButtonType="PushButton" UpdateText="Update" CancelText="Cancel" EditText="Edit">
                              <!-- other code here - styles etc -->
                    </asp:EditCommandColumn>
                     <FooterTemplate>
                              <asp:LinkButton id="LinkButton1" runat="server">LinkButton</asp:LinkButton>
                     </FooterTemplate>

If you are using Visual Studio, the intellisense will let you know what tags you can use within each programming object, and red squiglies will show up in your code if that tag does not go with the schema defined for ASP.NET.

 - Joe
0
 
LVL 3

Accepted Solution

by:
Realmrat earned 20 total points
ID: 12367277
Er, just realized that you need to take that footer code all the way out of the columns arena.

These probably arn't the right tags, but something like this:

<asp:DataGrid ... >
    <HeaderTemplate>
        ...
    </HeaderTemplate>
    <Columns>
        <asp:BoundColumn ... >
                ...
        </asp:BoundColumn >
        <asp:EditCommandColumn ... >
               ...
        </asp:EditCommandColumn>
    </Columns>
    <FooterTemplate>
        ...
    </FooterTemplate>
</asp:DataGrid>


Hope that helps.

 - Joe
0
 

Author Comment

by:kplonk
ID: 12592767
Thanks Kieran
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question