0

I have followed the steps in the following link Template Settings and created custom templates for Entry, Comment and Category. To the Custom Entry Template, I have added an additional field. I have a requirement to display it in the Categories.ascx. I am able to override the Categories.ascx but I am unable to get the value of the added field using WeBlog's API. Here's the code that I am using. But the issue is that the Class EntryItem doesn't have the additional field that I have added. Is there a way to read this field using WeBlog API?

EntryItem[] blogEntries = ManagerFactory.EntryManagerInstance.GetBlogEntries();
Martin Davies
  • 4,436
  • 3
  • 19
  • 40
Afroz
  • 1,017
  • 2
  • 12
  • 24

2 Answers2

1

EntryItem inherits from CustomItem I believe, so you can use the InnerItem Property to get access to the actual Item. Your field should then be available like this:

 entryItem.InnerITem["YouField"];

You can use a field renderer in the Categories.ascx file to display the value of you field and use data binding to get the item assigned to the field renderer.

 <sc:FieldRenderer ID="FieldRenderer1" runat="server" FieldName="YourField"  item='<%# entryItem.innerItem %>'/>
Ian Graham
  • 3,206
  • 1
  • 15
  • 23
0

In Categories.ascx you can add this code to render the new field on the front-end:

<sc:FieldRenderer FieldName="Your New Field Name" ID="frNewField" runat="server" />

Then in the C# code-behind, add this code to data bind the front-end field renderer to the entry item's underlying Sitecore item:

frNewField.Item = entryItem.InnerItem;
Mark Ursino
  • 31,209
  • 11
  • 51
  • 83