Sunday, July 29, 2012

Dynamically Apply/change SharePoint 2010 Header Image

In this post I will explained how we can dynamically apply/change SharePoint 2010 site Header Image. Create Image library, add image named “SiteHeaderImg.png” and below code in master page
<script type="text/javascript">
  
    function ChangeImage() {
        try {
     var URL_str = L_Menu_BaseUrl + '/ImageLibrary/SiteHeaderImg.png';
            
                document.getElementById("s4-titlerow").style.background = "background-image: url('" + URL_str + "') no-repeat";
                /* (Works in Firefox) */
  document.getElementById("s4-titlerow").style.background = "url('../ImageLibrary/SiteHeaderImg.png') no-repeat";
      
        }
        catch (e) {
            alert(e);
        }
    }
    _spBodyOnLoadFunctionNames.push("ChangeImage()");
 
</script>

Hosting SharePoint 2010 InfoPath form in web part

In this article I will explained how to add InfoPath form in SharePoint 2010 InfoPath form web part. Firstly we will create an  EmployeeDetails list
with following fields
 Now we will customize the InfoPath form as shown below
Now we will create SharePoint page and edit that page to insert InfoPath form web part on it