Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 507
  • Last Modified:

Adding Button to EditCommandColumn on a dtatagrid footer

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
kplonk
Asked:
kplonk
  • 2
1 Solution
 
RealmratCommented:
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
 
RealmratCommented:
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
 
kplonkAuthor Commented:
Thanks Kieran
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now