+1-888-365-2779
Try Now
More in this section

Forums / Designing & Styling / Module Builder Field & Template

Module Builder Field & Template

6 posts, 0 answered
  1. Amanda Shafer
    Amanda Shafer avatar
    198 posts
    Registered:
    12 Oct 2012
    27 Jan 2012
    Link to this post
    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?
  2. Boyan Barnev
    Boyan Barnev avatar
    1429 posts
    Registered:
    08 Dec 2016
    01 Feb 2012
    Link to this post
    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
  3. SVA Webmaster
    SVA Webmaster avatar
    85 posts
    Registered:
    18 Jul 2007
    17 Apr 2012
    Link to this post
    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!
  4. SVA Webmaster
    SVA Webmaster avatar
    85 posts
    Registered:
    18 Jul 2007
    17 Apr 2012
    Link to this post
    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!
  5. Amanda Shafer
    Amanda Shafer avatar
    198 posts
    Registered:
    12 Oct 2012
    17 Apr 2012
    Link to this post
    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.
  6. SVA Webmaster
    SVA Webmaster avatar
    85 posts
    Registered:
    18 Jul 2007
    17 Apr 2012
    Link to this post
    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


6 posts, 0 answered