Thursday, August 23, 2012

How to change the form header/footer color in MS CRM 2011 or Set Gradient color in MS CRM 2011 Header and Footer.


Lets I am creating in Account Entity.

First Create a Css called Header.css  using Web Resource in CRM.I give the Name new_Header in CRM.

.ms-crm-Form-HeaderContainer{ 
   filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffB3CAEC, 

endColorstr=#fff6f8faE); 
}

.ms-crm-Form-Footer{ 
   filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffB3CAEC, 

endColorstr=#fff6f8faE); 
   background-image: none; 
}

Now Create a Javascript using Web Resource that call this css during OnLoad Event.
I give Name new_HeaderJS in CRM.The Javascript is like this

function load_css_file(filename) { 
    var fileref = document.createElement("link") 
    fileref.setAttribute("rel", "stylesheet") 
    fileref.setAttribute("type", "text/css") 
    fileref.setAttribute("href", filename) 
    document.getElementsByTagName("head")[0].appendChild(fileref) 

}

function myFormOnLoad() { 

    load_css_file('/WebResources/new_Header'); 

}

Now Open Account Form and add the Library new_HeaderJS in Form Properties and add Event Handler and Pass a Function Name=myFormOnLoad.Then Save it and Publish it.

The Output is Like this.

No comments:

Post a Comment