Solved

Change the image of boundfield buttontype="image"

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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

627 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