c# - 使用列表在 Kentico 电子邮件模板中的宏
问题描述
我有一个名为 Notifications 的类对象列表
public class Notifications
{
public string Name { get; set; }
}
有一个函数只返回通知列表。我想构建一个电子邮件模板,在 Kentico 中使用宏显示所有通知信息,不幸的是,当我使用宏方法时,例如
{%
foreach (var Data in Notification) {
Data.Name
}
#%}
即使我确保所有数据都已成功发送到电子邮件,这样的宏根本不会返回输出,我想使用 foreach 循环。
解决方案
我想通了,我们必须继承
AbstractDataContainer<ClassName>
并注册我们正在使用的字段
public class Notifications: AbstractDataContainer<Notifications>
{ [RegisterColumn]
public string Name { get; set; }
}
因此我们可以在 foreach 循环中使用 List
推荐阅读
- python - python如何显示已签入的复选框
- javascript - 你如何反向滚动......所以它从下到上?
- spring-integration - Spring集成在Serviceactivator中使用指数退避实现失败消息的重试
- selenium - 是否可以使用 selenium 在 extjs 中捕获 ItemId 属性?
- javascript - 错误类型错误:无法读取 null 的属性“nom_gr”??在 Chrome 上
- javascript - 如何绕过文件加载器?
- amazon-web-services - 亚马逊如何使用域名在 ACM 中颁发 SSL 证书
- php - 检索邮递员在php中提交的json
- unity3d - 如何统一显示2个形状的相交边?
- java - 透明背景上的 setColor 未显示正确的颜色