Prasad Bolla's SharePoint Blog

Click Here to go through the Interesting posts within my Blog.

Click Here to go through the new posts in my blog.

Thursday, March 22, 2012

Binding Images to SharePoint or Asp.Net GridView BoundField using JavaScript

 function getImagestoGrid()
{
                var rows = document.getElementsByTagName('td');
                 var numRows = rows.length;
                 for (var i = 0; i < numRows; i++)
                {
                                if(rows[i].innerHTML=="In Progress")
                                {
                                                rows[i].innerHTML="<Img src='http://vlnrm:100/Shared Documents/Research and Development/Images/In Progress.jpg' width='25' height='25' Title='In Progress'>";
                                }
                               
                                if(rows[i].innerHTML=="Completed")
                                {
                                                rows[i].innerHTML="<Img src='http://vlnrm:100/Shared Documents/Research and Development/Images/Completed.jpg' width='25' height='25' Title='Completed'>";
                                }
                               
                                if(rows[i].innerHTML=="Deferred")
                                {
                                                rows[i].innerHTML="<Img src='http://vlnrm:100/Shared Documents/Research and Development/Images/Deferred.jpg' width='25' height='25' Title='Deferred'>";                 
                                }

                }
}
_spBodyOnLoadFunctionNames.push("getImagestoGrid");

No comments:

Post a Comment