?
Solved

Datagrid footer - basic question

Posted on 2004-10-07
4
Medium Priority
?
418 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 1200 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

770 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