Solved

Change the image of boundfield buttontype="image"

Posted on 2010-09-07
2
614 Views
Last Modified: 2013-12-17
I have the below code, how can I change the default image of the boundfield programmatically?
<columns>
               <asp:buttonfield buttontype="Image" commandname="Resume" ImageUrl="http://vmsd3jooc01/sites/applicantmanagement/PublishingImages/icons/attachmenticon.png" />
               </columns>

Open in new window

0
Comment
Question by:PagodNaUtak
2 Comments
 
LVL 12

Expert Comment

by:w00te
ID: 33623853
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.buttonfield.imageurl.aspx
public virtual string ImageUrl { get; set; }
Just set:
your_object_name.ImageUrl = "yourimagestringgoeshere.jpg";
anywhere in your C# code that has access to that element.
-w00te
0
 
LVL 8

Accepted Solution

by:
PagodNaUtak earned 0 total points
ID: 33625126
What my problem is how can I refference the object ButtonField since you cannot add an ID to it...
So to solve my problem I do the code below:

ImageButton imgResume = (ImageButton)e.Row.Cells[1].Controls[0];

imgResume.ImageUrl = "http://vmsd3jooc01/sites/applicantmanagement/PublishingImages/icons/null.bmp"; 

Open in new window

0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

777 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