Solved

Changing a imageurl in a datagrid when clicked on

Posted on 2004-10-20
8
466 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
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 63 total points
ID: 12366671
you can use javascript to change the src of the image at runtime..
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 6

Assisted Solution

by:Praesidium
Praesidium earned 62 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction                                                 Was the var keyword really only brought out to shorten your syntax? Or have the VB language guys got their way in C#? What type of variable is it? All will be revealed.   Also called…
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

707 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now