More in this section

Forums / Developing with Sitefinity / Sitefinity Custom Module and the MultiImageFieldElement

Sitefinity Custom Module and the MultiImageFieldElement

2 posts, 0 answered
  1. Bernstein-Rein
    Bernstein-Rein avatar
    30 posts
    Registered:
    12 Mar 2010
    12 Sep 2011
    Link to this post
    What is the datatype used for the MultiImageFieldElement?  I have the control showing up in the module's edit page, but I can't find what the data type is supposed to be used in the ViewModel or the FluentMappings; I keep getting various casting errors.

    This is what I have so far:

    Definition: (Works)
                MultiImageFieldElement imageField = new MultiImageFieldElement(mainSection.Fields)
                {
                    ID = "imageFieldControl",
                    DataFieldName = "Images",
                    DisplayMode = displayMode,
                    Title = "Images",
                    CssClass = "sfFormSeparator sfImageField",
                    WrapperTag = HtmlTextWriterTag.Li,
                    
                };
                mainSection.Fields.Add(imageField);


    ViewModel: (I also tried string)
            [DataMember]
            public ImageViewModel Images { get; set; }


    FluentMapping:
                itemMapping.HasProperty(p => p.Images).HasColumnType("varchar(max)");

  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    16 Sep 2011
    Link to this post
    Hi Patrick Herrington,

    If talking about eCommerce,

    You can use have the model as below.
    [DataMember]
            public List<ProductImage> Images
            {
                get { return images ?? (images = new List<ProductImage>()); }
                set { images = value; }
            }

    And the fluent mappings are done with LibrariesFluentMapping.

    But I am not sure if the question is specific to eCommerce.

    Greetings,
    Radoslav Georgiev
    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
2 posts, 0 answered