Saturday, July 16, 2011

SharePoint 2010 Content Editor webpart

I am a very big fan of Content Editor Webpart in Moss 2007. I have done many site customization's using CEWP in SharePoint 2007. Place a new html file, hack DOM elements using JQuery and modify the html elements, javascript etcs., I almost love it. Even I have developed a complete site using few CEWP's in SharePoint 2007.

I was hoping SharePoint 2010 would offer much more functionality to CEWP. But to the sad part it has worsened it usability. When I first tried inserting a CEWP in my SharePoint 2010 site, I virtually struggled to use it. I was trying to figure our how to insert my custom html. There was no Source editor in WebPart editor panel.

Edit Html source has been moved to the Ribbon. You have to click the "HTML-EditHTMLSource" and place your html.


And the worst part is now you cannot place any javascript code in the source editor(edit html source).

To place a javascript code you need to create a text file or html file and put your code there. Save it to some document library and link the file as show below in the editor pane


I like it in one way. We can checkin the code in Source control and deploy the text file or html file to the layouts folder and we can link it in our webpart so that we can have a backup of the code.

No comments:

Post a Comment