Copied to clipboard

Flag this post as spam?

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


  • Nigel Wilson 945 posts 2077 karma points
    Dec 30, 2011 @ 04:03
    Nigel Wilson
    0

    Listing of Media Types

    Hi all

    I am currently working on a project that requires listings of both all document types and media types

    The following code generates a checkboxlist of document types:

    Page Code

    <asp:CheckBoxList ID="cblRelatedTypes" runat="server" />

    Code Behind

    var docTypes = DocumentType.GetAllAsList();
    docTypes = docTypes.ToList();
    cblRelatedTypes.DataSource = docTypes;
    cblRelatedTypes.DataValueField = "Alias";
    cblRelatedTypes.DataTextField = "Text";
    cblRelatedTypes.DataBind();

    I an however completely stuck on generating the same sort of output for defined Media Types (Image, Folder, File, custom ones, etc).

    I could download the Umbraco source and try to track down how it's done, but thought I'd ask here first.

    Is someone able to assist in steering me away from the brick wall / sore forehead issue ?

    Cheers

    Nigel

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Dec 30, 2011 @ 14:03
    Tom Fulton
    1

    Hi Nigel,

    I think you should be able to do the same, but use this instead:

    umbraco.cms.businesslogic.media.MediaType.GetAllAsList()

    -Tom

  • Nigel Wilson 945 posts 2077 karma points
    Jan 03, 2012 @ 20:09
    Nigel Wilson
    0

    Hi Tom

    Back at work now and pleased to confirm you are bang on the mark - makes total sense but sometimes the fog coulds the grey matter (or maybe it's just old age).

    Cheers

    Nigel

Please Sign in or register to post replies

Write your reply to:

Draft