p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   ASP.NET 2.0 Basics (http://p2p.wrox.com/forumdisplay.php?f=136)
-   -   Moving the new/insert button on DetailsView (http://p2p.wrox.com/showthread.php?t=49565)

jpullam October 28th, 2006 07:02 PM

Moving the new/insert button on DetailsView
I have a GridView and DetailsView on a page, and when I specify
<asp:CommandField ShowEditButton="True" ShowInsertButton="True" ShowDeleteButton="True" /> at the bottom of the DetailsView, I get the 3 normal buttons rendered at the bottom of the DetailsView table it creates.

This seems like poor usability to me. When my user wants to insert a new record, he or she has to first get an existing record into the DetailsView Table, then click on "New". What I would rather have is the "new" button rendered elsewhere on the page, outside the DetailsView and GridView tables. I can see what the DetailsView is creating in the HTML code ... it looks like this:
<a href="javascript:__doPostBack('DetailsView1','Edit $0')">Edit</a>

I could probably just copy this elsewhere on the page, but that is a pretty bad coding practice.

What is the preferred method of creating the button outside the GridView and DetailsView? I tried doing my own <asp:Linkbutton> but either that's not allowed or I don't understand the syntax.

jpacev September 27th, 2007 10:33 AM

you can do that using this code:

this put de control in insert mode

newa_programmer September 27th, 2007 05:18 PM

Thanks jpacev,
It worked like a charm for me.
Any thoughts on invoking [Update] or [Insert] record button?

newa_programmer September 27th, 2007 05:29 PM

Figured out:


All times are GMT -4. The time now is 10:06 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.