Mar 24, 2007 at 8:26 PM
Edited Mar 24, 2007 at 8:33 PM
Has anyone been successful configuring one of these aweseome gridview subclasses for all three of the basic operations: Insert, Update, and Delete? I'm pretty close, but not quite there. Maybe someone else has gotten all three working at once? Here's where
Update: Well the basic BulkEditGridView gives you that, so thank you, we got that for free!!!
Insert: Easy, just set the EnableInsert and InsertRowCount properties, and you're there.
Delete: Here's where I'm stuck. I've tried a few things, including
http://www.codeplex.com/ASPNetRealWorldContr/Thread/View.aspx?ThreadId=8184, and that get's you close.
What happpens is that you get a delete button for both the existing and the new rows. It works, but the biggest problem is that the columns don't line up: The delete button for the new rows is nicely sized, but the column for existing rows is too wide, so the
columns of the table don't line up. A secondary problem is that the delete button probably should be hidden for new rows, but I can live with that one.
I've been experimenting with different buttonField declarations, including this:
<asp:ButtonField HeaderText="Delete" Text="Delete" ButtonType="Button"
ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Middle" ItemStyle-Width="52px" CommandName="Delete" >
<itemstyle width="52px" />
<headerstyle width="52px" />
But I can't get all the columns to line up, so I have a jagged table. Anyone?
Well that didn't take long for me to find my own answer: Yes!
Just make sure you have AutoGenerateDeleteButton="false" in your GridView declaration.