?
Solved

Add a linkbutton to the detailsview footer

Posted on 2007-07-26
7
Medium Priority
?
1,558 Views
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?

Thanks,
0
Comment
Question by:bertino12
  • 3
5 Comments
 
LVL 16

Accepted Solution

by:
TSmooth earned 1000 total points
ID: 19573828
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">
                    <EditItemTemplate>
                        <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" CommandName="Update"
                            Text="Update"></asp:LinkButton>
                        <asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Cancel"
                            Text="Cancel"></asp:LinkButton>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Edit"
                            Text="Edit"></asp:LinkButton>
                        <asp:LinkButton ID="lbTest" runat="server" Text="Text LB"></asp:LinkButton>
                    </ItemTemplate>
                </asp:TemplateField>

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).
0
 
LVL 22

Assisted Solution

by:DarkoLord
DarkoLord earned 1000 total points
ID: 19573850
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.
0
 
LVL 16

Expert Comment

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

Author Comment

by:bertino12
ID: 19574369
Sorry Ill have a mod correct this.
0
 
LVL 16

Expert Comment

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

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net 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…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

840 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