Module Builder Field & Template
I am trying to get the value of a field into a custom module template (having used the new module builder to create it)
I have a choices field called BoothSize. I want that value to be the class of a line.
<li class='<%# DataBinder.Eval(Container.DataItem, "BoothSize") %>'>
But when I this, the html renders as: <li class="System.String[]">
How can I get the actual value?
Hello,
Can you please try getting the value of the dynamic field in the temp[late code-behind. SInce the Dynamic modules metafields cannot be resolved on the fly with Eval syntax, it is normal for the expression to return the type of the field but not the actual selected value. However you can easily obtain it in the codebehind using our extension method GetValue, for example you can say MyDynamicModule.GetValue("BoothSize").
Greetings,
Boyan Barnev
the Telerik team
Hi Boyan,
Hi Boyan,
Make sure you have a reference to Telerik.Sitefinity.Model . So ..
using Telerik.Sitefinity.Model
Then you should be able to use the code examples provided with the custom module builder to get the values.
Hi Amanda,
Imports Telerik.Sitefinity.ModelImports Telerik.OpenAccessImports Telerik.Sitefinity.ModulesPartial Class SfCtrlPresentation_OpenAccessDataProvider_1e7c45c2401c4de7b10b64fda20d92e2 Inherits System.Web.UI.UserControl Protected Sub dynamicContentListView_ItemDataBound(sender As Object, e As Telerik.Web.UI.RadListViewItemEventArgs) Handles dynamicContentListView.ItemDataBound If e.Item.ItemType = Telerik.Web.UI.RadListViewItemType.AlternatingItem Or e.Item.ItemType = Telerik.Web.UI.RadListViewItemType.DataItem Then End If End SubEnd Class