MSMVPS.COM
The Ultimate Destination for Blogs by Current and Former Microsoft Most Valuable Professionals.
SharePoint Master Page Customization - ASP.NET Image Vs Html Image Controls

Scenario

We tried to customize the the master page of a SharePoint site (Team Site). The intent was to add banner image and icon to the master page. We edited the master page using SharePoint Designer 2007. We dragged and dropped the image to the master page and aligned it. We saved all the changes. Then, we refreshed the site. The changes were reflected. We saved this customized site as the site template ".stp" and shipped it                                Whenever someone creates a site using this ".stp", the images are not rendered in their newly created site using this site template 

Cause of the Problem

After analysis we found that, the images in the master pages were not picking the URL relative to the newly created site. It's picking the URL relative to old site, from which the template was created

 <img alt="" src="/Sites/old site/_catalogs/masterpage/testimage.gif" width="974" height="69"></td> 

If we set the relative URL in both the Notepad and the SharePoint Designer, after the save of master page it's always not reflecting the relative URL

Resolution

We replaced the image tag with ASP.NET Image server control

<asp:Image ImageUrl="./../../images/testimage.gif" runat="server"/>

This made it to work. Whenever we need to disribute a sharepoint site template with custom master pages, it's better to use ASP.NET Image control instead of <img> tags

 

 


Posted Fri, Feb 1 2008 2:27 by lavssun

Add a Comment

(optional)  
(optional)
(required)  
Remember Me?