Module Builder Field & Template - Front- & Back-End Development - Front- & Back-End Development - Progress Community
 Front- & Back-End Development

Module Builder Field & Template

  • 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
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  • Hi Boyan,

    I am wanting to do exactly what she was talking about, but I need further clarification. In my codebehind, I am working within the dynamicContentListView_ItemDatabound event. How would I reference the .GetValue of my custom module. My module is called "Speakers". If I simply type Speakers.GetValue("FieldName") it doesn't resolve "Speakers" as an object. I've tried importing the Telerik.Sitefinity.Modules but that doesn't help either. Can you please spell this out clearer for me?

    Thanks!
  • Hi Boyan,

    I am wanting to do exactly what she was talking about, but I need further clarification. In my codebehind, I am working within the dynamicContentListView_ItemDatabound event. How would I reference the .GetValue of my custom module. My module is called "Speakers". If I simply type Speakers.GetValue("FieldName") it doesn't resolve "Speakers" as an object. I've tried importing the Telerik.Sitefinity.Modules but that doesn't help either. Can you please spell this out clearer for me?

    Thanks!
  • 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,

    I to have that reference. Can you give me a code example for what I'm looking for? I am unable to find anything. I too am wanting to assign a dynamic class to the widget's li rendering, just as you specified in your original post. Thanks! This is where I'm at code-wise so far:

    Imports Telerik.Sitefinity.Model
    Imports Telerik.OpenAccess
    Imports Telerik.Sitefinity.Modules
     
    Partial 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 Sub
     
    End Class