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

Forums / General Discussions / Sample Generic Content based module: Products module

Sample Generic Content based module: Products module

4 posts, 0 answered
  1. Sergio
    Sergio avatar
    21 posts
    Registered:
    02 Feb 2009
    02 Sep 2009
    Link to this post
    Dear Sirs,
    we have used the Products Module (http://www.sitefinity.com/blogs/ivan/posts/09-03-11/sample_generic_content_based_module_products_module.aspx).
    We need to upload and show multiple images (like a slideshow of photos) related to a specific product detail and maybe some thumbnails for the list (like in the New module).
    Have you already developed somthing like that? We've seen that this module has very basic funcionalities.
    Thank you very much for your help.
    Best regards,
    Sergio
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    02 Sep 2009
    Link to this post
    Hi Sergio,

    Products modules is a simple sample module that shows basic classes and logic for implementing complex modules. However you can create a new metakey and add ButtonSelector for uploading Images into your database/ getting images from Images and Documents module/ getting -uploading images to your file system.
    For showing the photos you can use RadRotator control that you can bind to XmlDataSource or using ObjectDataSource and bind it to Images and Documents library. If you have several images that will be assiciated with an item you should better store them in one Library or categorize them. If you want to show your images as on the frontend of your website you should create a control that inherits from ContentView.

    I hope that this helps.

    Greetings,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Sergio
    Sergio avatar
    21 posts
    Registered:
    02 Feb 2009
    04 Sep 2009
    Link to this post
    Hi Ivan,
    since I am facing many difficulties in developing the products detail view (which should show a detailed view of the product with many photos of the product itself), I ask you a question:
    what can I do in order to have the same products page as showed here http://www.sitefinity.com/help/developer-manual/products-module-simple-module-categorized.html with the difference that instead of one image per book I can have many (with a rotaror)?
    How can I implement that? Where can I start from? How can I bind the multiple photos of a product to the control?
    Thank you very much for your help.
    Sergio
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    04 Sep 2009
    Link to this post
    Hi Sergio,

    :...instead of one image per book I can have many (with a rotaror)?"

    However you can create a new metakey and add ButtonSelector for uploading Images into your database/ getting images from Images and Documents module/ getting -uploading images to your file system.
    For showing the photos you can use RadRotator control that you can bind to XmlDataSource or using ObjectDataSource and bind it to Images and Documents library. If you have several images that will be assiciated with an item you should better store them in one Library or categorize them. If you want to show your images as on the frontend of your website you should create a control that inherits from ContentView.


    How can I implement that? Where can I start from? How can I bind the multiple photos of a product to the control?

    1.Your control should be implement IToolboxItem.

       public override IList<IToolboxItem> Controls 
            { 
                get 
                { 
                    return new List<IToolboxItem> { new CustomViewToolboxItem() }; 
                } 
            } 

    2. You need to create a public view control for your view that inherits from ContentView class.

     public class CustomPublicView : ContentView 
        { 
          ... 
             ... 
        } 

    You should also create a toolbox item

     public class CustomViewToolboxItem : ToolboxItem 
        { 
            /// <summary> 
            /// Constructs a new instance of CustomViewToolboxItem class and sets DisplayName and Description 
            /// properties for the NewsArchive control.  
            /// </summary> 
            public CustomViewToolboxItem () 
                : base(typeof(CustomPublicView)) 
            { 
                base.DisplayName = Messages.CustomPublicView_DisplayName; 
                base.Description = Messages.CustomPublicView_Description; 
            } 
        } 


    3. You should create a control designer that inherits form ContentViewDesignerBase and set a template for your designer.

    public class CustomDesigner : ContentViewDesignerBase 
        { 
            public override string  DesignerTemplateName 
            { 
                get  
                {  
                    return CustomDesigner.layoutTemplateName; 
                } 
            } 
     
            private const string layoutTemplateName = "Telerik.Samples.CustomModule.Resources.ControlTemplates.Backend.CustomControlDesigner.ascx"
        } 


    4. You should have public templates for your ContentView based controls that should have a rotator control inside an repeater.

    5. You should override CreateChildControls method in your CustomPublicView and bind the rotator there.

    protected override void CreateChildControls() 
            { 
                
                //this.CreateContentList(this.RotatingListSimpleContainer); 
               if (this.DesignMode) 
               { 
                   this.Controls.Clear(); 
                   Label lbl = new Label(); 
                   lbl.Text = "The control cannot be previewed in design mode"
                   Controls.Add(lbl); 
               } 
               else 
               { 
                    base.CreateChildControls(); 
                    IList datasource = Manager.GetContent(); 
                    this.ImageRotator.DataSource = datasource; 
                    this.ImageRotator.ItemDataBound += new RadRotatorEventHandler(ImageRotator_ItemDataBound); 
                    this.ImageRotator.DataBind(); 
               } 
            } 


    You can gather more information form Binding to ASP DataSource components, Online TOC ( it is migrate to chm version of Developers Manual for Sitefinity.)

    All the best,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Register for webinar
4 posts, 0 answered