Need to change image of imagebutton in datagrid template column

J

jef

I'm going nuts.. I've got a template column with an imagebutton in it.
I would like to change the image on the button when the button is
clicked. However, in the _ItemCommand() function I can't seem to
figure out how to get a reference to the imagebutton object. Help
anyone?
 
B

Brock Allen

In the ItemCommand, take the ItemCommandEventArgs and do a ItemCommandEventArgs.Item.FindControl("IDOfYourImageCtrl")
and cast it to a ImageButton. Then you'll be able to work with it.
 
J

jef

Thanks... that works fine. That said, does anyone know how to do the
same thing only with client-side code? Seeing that I don't know the
name of the control inside the template column, I'm not sure how I
would reference it in Javascript.
 

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,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top