View Single Post
Old October 28th, 2006, 07:02 PM
jpullam jpullam is offline
Authorized User
Join Date: Oct 2006
Location: Toronto, Ontario, Canada.
Posts: 20
Thanks: 1
Thanked 0 Times in 0 Posts
Default 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.