GridView ButtonField RowCommand Image/Button problem

N

nx-2000

ASP.Net 2.0. I've got a GridView, its got a DataKeyNames set to the ID
of the item that's in a row. I added a ButtonField column, made it a
Button type with my "Remove" text, and when I hit the button, my
CommandArgument in the RowCommand event is my ID field.

Now, when my boss tells me that he wants a little delete picture
instead of the word Remove, I go back, change the ButtonType property
to Image and set the ImageUrl. When I click the image, my RowCommand
event has the row *index* as the CommandArgument, not the ID field as
before.

I can switch back and forth between Button and Image(or Link)
ButtonType to easily replicate this behavior.

Is it supposed to be my DataKeyNames field, or is it supposed to be the
row index?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top