Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Gordon Saxby 1347 posts 1608 karma points
    Oct 12, 2011 @ 15:07
    Gordon Saxby
    0

    How do I bind to a Repeater

    If I have this -

                rptImages.DataSource = umbraco.library.GetMedia(shopImageFolder, true);
                rptImages.DataBind();

    in code, how do I get a Repeater to display the images found? (There will ONLY be images)

    I created a ItemTemplate with an IMG tag, but I can't get the bind bit to work!?

     

     

  • Jeroen Breuer 4861 posts 12138 karma points MVP 3x admin c-trib
    Oct 12, 2011 @ 15:21
    Jeroen Breuer
    0

    I've used something like this for DAMP. There I bind it to a ListView.

    Have a look at the source code in DigibizAdvancedMediaPicker.ascx.cs. Look at the set part of the value property on line 236. I have a list and I use ConvertXML to fill that list. You can't use that method exaclty since the xml is a bit different and not recursive (doesn't display the children), but it should get you started :).

    Jeroen

  • Bo Damgaard Mortensen 712 posts 1189 karma points
    Oct 12, 2011 @ 21:48
    Bo Damgaard Mortensen
    0

    Normally I'm just creating a class with properties like src, width, height and such. Something like:

    public string Src { get; set; }
    public string Width { get; set; }
    public string Height { get; set; }

    And then sweep throgh the image collection, create a new object, add it to a list and then bind the repeater to the list with an Image in the itemtemplate.

    - Bo 

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies