Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I edited the Articulate Post document type and added a textbox to the Image tab called "Alt Text". Then, in the Post.cshtml view, I tried changing the alt text to:
<img class="postImage img-responsive" alt="@Model.altText" src="@cropUrl" />
and I got a compiler error:
Compiler Error Message: CS1061: 'Articulate.Models.PostModel' does not contain a definition for 'altText' and no extension method 'altText' accepting a first argument of type 'Articulate.Models.PostModel' could be found (are you missing a using directive or an assembly reference?)
My digital marketing team really wants the option to add custom alt text to these images and I've already used the Image tab for over 100 blog articles. Changing them to images inside the Rich Text Editor would be an onerous task. How can I add this custom alt text?
try using the following:
Compiler Error Message: CS0122: 'Umbraco.Core.Models.PublishedContent.PublishedContentWrapped.Content' is inaccessible due to its protection level
can you post the entire Post.cshtml view?
Layout = "Master.cshtml";
ViewBag.CssBodyClass = "post-template";
<div class="col-xs-12 col-sm-4">
var cropUrl = Model.GetCropUrl("postImage", "full");
<img class="postImage img-responsive" alt='@Model.Content.getPropertyValue("altText")' src="@cropUrl" />
<div class="col-xs-12 col-sm-7 col-md-5">
<time datetime="@Model.PublishedDate.ToString(" yyyy-MM-dd")">
@Model.PublishedDate.ToString("dddd, MMMM dd, yyyy")
<span class="post-author">By @Model.Author.Name</span>
Your view has this: @model Articulate.Models.PostModel which means that the Model of your page == Articulate.Models.PostModel which in turn implements IPublishedContent, so you can use all of the features of IPublishedContent based on your Model such as @Model.GetPropertyValue("altText")
You cannot just do @Model.altText because Model == Articulate.Models.PostModel, it has no property called altText. Articulate uses strongly typed views so dynamics are not supported.
(btw, we are dropping dynamics support in v8)
dropping dynamics support in v8: good so we'll have a one mode to access data.
var typedMultiMediaPicker = Model.Content.GetPropertyValue<IEnumerable<IPublishedContent>>("caseStudyImages");
var typedMultiMediaPicker = Model.GetPropertyValue<IEnumerable<IPublishedContent>>("documents");
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted