当我运行该页面时,我收到此错误消息: ht-6ren">
gpt4 book ai didi

html - 在 img 源属性 (Umbraco) 中插入媒体 url 时出现 CS1502 错误

转载 作者:行者123 更新时间:2023-12-02 10:54:02 24 4
gpt4 key购买 nike

我想在我的主模板上显示一个标题 Logo 。

到目前为止,我有这个代码:

<h1 class="brand_name">
<a href="/"><img width="320px"
src='@(Model.Content.GetPropertyValue<IEnumerable<IPublishedContent>>
("headerLogo").Url)'>
</a>
</h1>

当我运行该页面时,我收到此错误消息:

http://i.imgur.com/4RaL947.png

我不确定是什么导致了这个错误,因为格式对我来说很好。标题 Logo 的 mediapicker 属性编辑器在语言文档类型中定义,该类型以母版为模板。

最佳答案

您告诉 GetPropertyValue 尝试返回 IPublishedContent 的 IEnumerable,但您立即尝试使用单个 .Url。您是否尝试过 Model.Content.GetPropertyValue ("headerLogo").Url ?

关于html - 在 img 源属性 (Umbraco) 中插入媒体 url 时出现 CS1502 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45792189/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com