Add a linkbutton to the detailsview footer

Posted on 2007-07-26
Last Modified: 2008-01-09
I would like to add a linkbutton to the detailsview control. I want this button to show up next to the edit button. How can I do this?

Question by:bertino12
    LVL 16

    Accepted Solution

    Convert your edit/command field to a template field and then in the source designer, your command field will become something like this:

    <asp:TemplateField ShowHeader="False">
                            <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" CommandName="Update"
                            <asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Cancel"
                            <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Edit"
                            <asp:LinkButton ID="lbTest" runat="server" Text="Text LB"></asp:LinkButton>

    If you look at the above, you can see that I added "lbTest" linkbutton to go right next to the Edit button. Since this is inside the <ItemTemplate> of the template field, it will only be displayed when the item is not in edit mode. If you want it displayed in edit mode too, add the link button to the <EditItemTemplate> as well.

    If you really want the button to be in the "Footer", then you could instead put the link button inside the detailsview <FooterTemplate></FooterTemplate> (Add the tags if they aren't there).
    LVL 22

    Assisted Solution

    Go to DetailsView tasks, choose Edit Fields, add a CommandField (Edit, Update, Cancel) and convert it into the TemplateField and click OK. Then right click the DetailsView and go to Edit Template -> Field[0] (where 0 can be another index if you have multiple template fields). You can add a linkbutton there.
    LVL 16

    Expert Comment

    That's the same thing I said to do first :-/  Oh well, glad you got it working.

    Author Comment

    Sorry Ill have a mod correct this.
    LVL 16

    Expert Comment

    It's not a huge deal, the points don't really mean anything compared to helping people solve problems. Don't worry about it.

    Featured Post

    Gigs: Get Your Project Delivered by an Expert

    Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

    Join & Write a Comment

    Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
    One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on could not pull conte…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    755 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

    17 Experts available now in Live!

    Get 1:1 Help Now