>I am sure this is simple, but it is sure stumping me!
>How do I capture a button click event on a template column of an ASP.NET grid? The button in the template column does not have an events tab.
>
>Here are the steps I performed: I added a template column to the grid - dropped a button in the item section of the template editor - set the CommandName of the button to 'Configure' - ensured CausesValidation=True - created an ItemCommand event on the grid.
>
>The button seems to refresh the page, but where can I capture this event so I can do work?
>
>Thanks!
>Troy
Troy,
You have to handle the click in the ItemCommand event. Test e.CommandSource.CommandName to determine which button was clicked (you might have to cast e.CommandSource as a CommandButton to avoid a compiler error).
There is a nice series of articles on the DataGrid at
http://aspnet.4guysfromrolla.com/articles/040502-1.aspx