Thursday, August 25, 2011

Content Editor Web Part in SharePoint 2010

In this post we will discuss about what is content editor webpart in SharePoint 2010. Also you can check out my previous posts on:

- Create Search Service Application in SharePoint 2010

- LINQ to SharePoint 2010

- Different list items events in SharePoint 2010

Content Editor webpart is an out of box webpart comes with all SharePoint 2010 versions. It can hold HTML, JavaScript and CSS. You can edit the content editor webpart, and point it to a
txt file location where the actual content is.
To add a content editor web part into your page. Edit the Page -> From the ribbon click in Inset then select web part. Then from the list of web part categories, select Media and Content category and then Select Content editor web part and click on add as shown below figure.

To get the source editor in the ribbon is a bit difficult, for this select the content editor web part then from the ribbon, From Editing tools select Format text and then click on the HTML in the right hand side. then click on Edit HTML source as shown in the figure below.

To start writting text to the web part edit the web part and then write the text. Then click on apply and Ok.

To add Javascript code go to the HTML source as explained above and write the code in the editor like below
<script type="text/javascript">document.write("Hello World !!!");</script>

You can also check about XSLT list view web part in SharePoint 2010

No comments:

Post a Comment