I have an ASPX page that is dynamically creating a gridview from a database table. Each time the gridview is created on postback, I set the AutoGenerateDeleteButton attribute to true. However, the first time the gridview is created the delete button isn't displaying. I wrote the value of AutoGenerateDeleteButton and it is True. When I add a second row to the gridview, the delete button then displays. Any suggestions?
+1
A:
Are you initially creating the gridview after the binding events would have fired?
If so, any controls that would be created during the gridview's binding events would not have fired, which would explain why the delete button is not being displayed.
Just as a clarification: Your question actually states that the delete button is displaying both the first time and the second time. I'm assuming it's the first time that it isn't showing?
Jay S
2009-01-26 14:05:45
+1
A:
Instead of setting AutoGenerateDeleteButton to "true", I just dynamically created a CommandField and added it as a column to the gridview. This seems to work every time. But thanks for the suggestions.
Brian Lewis
2009-01-26 16:26:21