Solved

Change the image of boundfield buttontype="image"

Posted on 2010-09-07
2
616 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

839 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