Solved

Datagrid footer - basic question

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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
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…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

696 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