Category

Sitecore

Category

For a blog module that I am developing I wanted to create an custom item editor. As you might know those are the “tabs” in the Content Editor.

1. Create a aspx file for the item editor user interface.
2. Select the core database in the desktop mode
3. Open the Content Editor and go to the following path /Sitecore/Content/Applications/Content Editor/Editors/Items.
4. You can create an item editor using the /Sitecore Client/Content Editor/Editor data template.
5. You can give your item editor a name using the header field in the data section.
6. In the icon field you can enter a path to the icon.
7. In the url field you need to fill in the url to the aspx file created in step 1
8. Save the item.
9. Switch back to the master database.

These days streaming video on the web is quite popular. In almost every project we do at Evident Interactive the customer wants to embed video in content items. Off course they can do that by copy-pasting the embedding code in a Sitecore field or in the rich-text editor. But that is not the most user-friendly method. I thought it would be nice if an end-user could just copy-paste the url of the page and let an custom control do the rest. So I created a custom field, webcontrol, some xsl extensions an a addition to the flashmanager. Let’s say that we want to embed this video from YouTube. I go to the content editor and paste the url in a field of the type “Video Embed”.

Custom field

When you want to use a fieldcontrol like a Text, Link or Image control in a ListView you need to specify a datasource. By not specifying a datasource Sitecore looks at the current item. Which in a ListView is not the right one. So you need so set the datasource in code-behind or use an Eval expression in code-before.

When you want you use the code-behind option you need to raise an eventhandler which triggers the ItemDataBound handler.In that event you want to get the values of the current item. So you need to cast the ListViewDataItem to an Sitecore item.