Solved

Datagrid footer - basic question

Posted on 2004-10-07
4
403 Views
Last Modified: 2008-03-17
I have seen a few articles on adding a "add new record" sort of feature in the footer of a datagrid.  I would like to know if it is possible to do the following:

Have an EditCommandColumn and a DeleteCommandColumn that has a footer template so that I can add the "add" button in the footer of the EditCommandColumn and a "Cancel" button in the footer of the DeleteCommandColumn.

I attempted to do this by turning the Edit/DeleteCommandColumns into Template columns and then the appropriate commandevents stopped working and became intercepted by the itemcommand event.  Here is what I did for the edit command column:

                                        <asp:TemplateColumn>
                                    <ItemTemplate>
                                          <asp:LinkButton runat="server" Text="Edit" CommandName="Edit" CausesValidation="false"></asp:LinkButton>
                                    </ItemTemplate>
                                    <FooterTemplate>
                                          <asp:linkbutton ID="lnkAdd" Runat="server" Text="Add" CommandName="Add"></asp:linkbutton>
                                    </FooterTemplate>
                                    <EditItemTemplate>
                                          <asp:LinkButton runat="server" Text="Update" CommandName="Update"></asp:LinkButton>&nbsp;
                                          <asp:LinkButton runat="server" Text="Cancel" CommandName="Cancel" CausesValidation="false"></asp:LinkButton>
                                    </EditItemTemplate>
                              </asp:TemplateColumn>

Thanks for your help!  I've been working on this for days and it's driving me nuts!!
0
Comment
Question by:tsbathe
  • 2
4 Comments
 
LVL 33

Accepted Solution

by:
raterus earned 300 total points
ID: 12253159
Are you sure you just aren't misunderstanding how DataGrid events are fired? The ItemCommand event of the datagrid gets fired for every event, even when you click edit/update/cancel/delete.  Then the datagrid fires events for Update/Cancel/Delete Commands.  If you don't want anything to happen in the ItemCommand event, you have to write checks to do this.  Usually I find this works in the ItemCommand events.

If e.CommandName = "Select" Then
  'do something other than update/edit/delete/cancel
End IF
0
 
LVL 15

Expert Comment

by:praneetha
ID: 12253168
so what happens now...

edit and delete don't fire....or any exception...
0
 
LVL 15

Expert Comment

by:praneetha
ID: 12253178
yeah u have to use e.CommandName.....

0
 

Author Comment

by:tsbathe
ID: 12254480
YES!!!  You are right!!!!!  I did not understand that, thank you so much!!!!!!
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

708 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now