Monday, 30 June 2014

How to bind sitecore field inline in repeater control?

Friends, How are you all doing?
I know you may have a question - "Long time, No Posts?" Yeah, I got some halt (e.g. busy with new project) in my sitecore journey. And in this halt - I have learnt many new things, now it's time to share these leanings.
So let's start knowledge sharing.

Have you come across a requirement where you are using control (e.g. repeater control) and you want to bind sitecore item field values inline without using any or sitecore control? If so, then this post may help you.

Many of you have rendered sitecore field value inline using below approach which is completely correct.
But, what if you want to bind sitecore field value without using any sitecore control (e.g. sc:fieldrender) or control?
In such case, you can use following approach:

            <%# ((Sitecore.Data.Items.Item)(Container.DataItem)).Fields["Text Heading"].Value %>
This is how you can render sitecore field inline:
<%# ((Sitecore.Data.Items.Item)(Container.DataItem)).Fields["Text Heading"].Value %>