Home All Groups Group Topic Archive Search About

ImageButton in a datagrid. How do I determine on which row I am?

Author
3 Jan 2006 3:08 PM
ThunderMusic
Hi,

I have an ImageButton in a DataGrid (each row has it's ImageButton). When I
click on this ImageButton, I must delete a row in my database. As a result,
I must know on which ImageButton the user clicked (well, on which row). How
can I do that? it's probably very simple, but I really don't know how to do
it.

Thanks

ThunderMusic

Author
3 Jan 2006 5:35 PM
Zamdrist
I have used the UpdateCommand Sub of the Datagrid to grab the valued of
the active row, if you will.

ByVal E As System.Web.UI.WebControls.DataGridCommandEventArgs

That is an argument used in the UpdateCommand.

Therefore: E.Item.Cells(1).Text retrieves the my primary key needed for
the update.

Someone else who knows datagrids better than I might be able to explain
it better though :)