Archive for October, 2012

October 29, 2012

Google Map Visual Web Part

Finally was able to finish the share point 2010 visual web part which i was working on. Seems the webpart looks cool. Its nothing other than JQuery and Google MAP API v 3.o with customization.

refer the google map API documentation for the v 3.0 via this link.

the interesting part of the above web part is that the markers used to fly in to the locations based on the category. you can refer the following out of the box source code below with zero customization:

http://code.google.com/

Advertisements
October 29, 2012

Dynamically load CSS file on SharePoint 2010

I was in a situation where i had to load a share point page into SPDialog (SP.UI.ModalDialog.showModalDialog) after removing the unwanted tags like header, footer, the ribbon, etc. (just need to add the class=”s4-notdlg” for the tags you are expecting not to be included in the dialog).

So in that case you will be in a situation where you may need to remove the background of the dialog which automatically inherits from the parent, etc in other words you may have to load a new CSS when the dialog window opens. Please follow the steps as below to load a CSS file on the fly.

var isInIFrame = window.location != window.parent.location;
	if(isInIFrame)
	{
		 var fileref=document.createElement("link")
  		 fileref.setAttribute("rel", "stylesheet")
 		 fileref.setAttribute("type", "text/css")
 		 fileref.setAttribute("href", "/Style%20Library/ar-sa/css/My_Dialog.css")
 		 if (typeof fileref!="undefined")
		 document.getElementsByTagName("head")[0].appendChild(fileref)

refer the following link for more details to read about more on above.

http://www.javascriptkit.com/

if you want to change the dialog borer, the background of the dialog caption then add the following style into your CSS file

/* dialog border black and the title of the background */

.ms-dlgBorder, .ms-dlgContent {border:1px solid #333;}
.ms-dlgTitle {
border:none;
border-bottom:1px solid #fff;
background-color:black;
}