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
Solved

Datagrid footer - basic question

Posted on 2004-10-07
4
411 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
IIS redirect 1 77
Moving code from one TFS branch to another 3 33
asp Google Map 2 31
VS 2015 is giving [No relevant source lines] 2 26
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

856 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