0

I'm using Umbraco 4.7.1 and have created a custom DocumentType called "Partner". I want to use that custom DocumentType in a masterpage. I'll show the code.

public class Partner : IdentifyingMarkRemoved.DocumentTypes.Page {

    [DocumentTypeProperty(UmbracoPropertyType.Textstring, Mandatory = true, Tab = "Content")]
    public string PartnerName { get; set; }

    [DocumentTypeProperty(UmbracoPropertyType.Textstring, Mandatory = true, Tab = "Content")]
    public string PartnerLevel { get; set; }

    [DocumentTypeProperty(UmbracoPropertyType.Upload, Mandatory = true, Tab = "Content")]
    public string PartnerLogo { get; set; }

    [DocumentTypeProperty(UmbracoPropertyType.RichtextEditor, Mandatory = true, Tab = "Content")]
    public string PartnerDescription { get; set; }
}

Thats the custom DocumentType.

The Masterpage looks like this:

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

<div id="partnerName"><%= this.CurrentContent.PartnerName %></div>
<div id="partnerLevel"><%= this.CurrentContent.PartnerLevel %></div>
<div id="partnerLogo"><%= this.CurrentContent.PartnerLogo %></div>
<div id="partnerDescription"><%= this.CurrentContent.PartnerDescription %></div>
</asp:Content>

Essentially what happens is a user will create a new page of type "Partner" and the application will demand those four pieces of information from them.

The user will upload an image and when the resulting page is created, the image is shown on the page.

Problem is, what I am getting when I test is this:

partnersname

partnerslevel

/media/541/plogo.jpg

Random text again

I have tried to represent the PartnerLogo as a type "object" so I could cast it to a type "Image" but that gives me an error.

I've tried doing that in the code behind, but again, I get an error.

I have attempted various combinations of quotes and nested asp commands, but nothing seems to be working.

I do have the sense that I'm on the edge of getting this right, but I'm too much of an ASP noob to know where I'm going wrong.

Looking forward to some help!

awrowe
  • 3
  • 2

1 Answers1

1

The image is stored as a string, referencing the URL the image is to be found at. So you will need to add your own tag in the HTML. Something like this should work:

<img src='<%= this.CurrentContent.PartnerLogo %>' />
sebastiaan
  • 5,870
  • 5
  • 38
  • 68