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:
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?
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.
How to add custom alt text to the Post Image
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:
and I got a compiler error:
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?
Hi Joshua,
try using the following:
@Model.GetPropertyValue("altText")
/Michael
Hi Joshua,
can you post the entire Post.cshtml view?
/Michael
Use:
@Model.GetPropertyValue("altText")
Your view has this:
@model Articulate.Models.PostModel
which means that the Model of your page ==Articulate.Models.PostModel
which in turn implementsIPublishedContent
, so you can use all of the features ofIPublishedContent
based on your Model such as@Model.GetPropertyValue("altText")
You cannot just do
@Model.altText
because Model ==Articulate.Models.PostModel
, it has no property calledaltText
. 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.
How can we access custom variables in V8?
Perfect! Thanks!
Good!
Example:
From
to
is working on a reply...