Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Adding Button to EditCommandColumn on a dtatagrid footer

Posted on 2004-10-20
3
Medium Priority
?
495 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
  • 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 60 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Loops Section Overview

885 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