?
Solved

Changing a imageurl in a datagrid when clicked on

Posted on 2004-10-20
8
Medium Priority
?
475 Views
Last Modified: 2008-02-01
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
Comment
Question by:aasaif00
  • 3
  • 2
6 Comments
 
LVL 6

Expert Comment

by:Praesidium
ID: 12363569
A single image button?  Or multiples?  Static?
0
 

Author Comment

by:aasaif00
ID: 12364501
a single image button which contains a imageurl set to a image in my project
it belongs to a column in a datagrid
0
 
LVL 6

Accepted Solution

by:
zulu_11 earned 252 total points
ID: 12366671
you can use javascript to change the src of the image at runtime..
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 6

Assisted Solution

by:Praesidium
Praesidium earned 248 total points
ID: 12366702
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
 

Author Comment

by:aasaif00
ID: 12369525
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
 

Author Comment

by:aasaif00
ID: 12370284
ImageButton Btn1      =(ImageButton)e.Item.FindControl("ImageButton1");

i got it thanks
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Integration Management Part 2
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question