• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 479
  • Last Modified:

Changing a imageurl in a datagrid when clicked on

I have a datagrid column where an imagebutton exists.  I want to be able to when a user clicks on that image button I change the imageurl to a different image.  I do not know how to declare in the code behind file a imagebutton in a datagrid.
0
aasaif00
Asked:
aasaif00
  • 3
  • 2
2 Solutions
 
PraesidiumCommented:
A single image button?  Or multiples?  Static?
0
 
aasaif00Author Commented:
a single image button which contains a imageurl set to a image in my project
it belongs to a column in a datagrid
0
 
zulu_11Commented:
you can use javascript to change the src of the image at runtime..
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

 
PraesidiumCommented:
Right, you can code your C# so that it will write the javascript for you... something like:

YourImageButtonName.Attributes.Add("onMouseOver","this.firstChild.src='/media/images/nav-Roll.gif'");

and so on and so forth, with onclick, mouseout, etc etc.
0
 
aasaif00Author Commented:
However it is possibe to find a imagebutton control within a Datagrid right, if i can do that it would be so much easier
0
 
aasaif00Author Commented:
ImageButton Btn1      =(ImageButton)e.Item.FindControl("ImageButton1");

i got it thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now