?
Solved

Changing a imageurl in a datagrid when clicked on

Posted on 2004-10-20
8
Medium Priority
?
473 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
8 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses
Course of the Month10 days, 3 hours left to enroll

762 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