我正在尝试使用两个输入字段名称和电子邮件地址构建一个非常简单的小部件。现在我正在关注http://www.deepcode.co.uk/search?q=how+to+build+a+widget+without+a+model+in+Orchard。
public int UpdateFrom22()
{
ContentDefinitionManager.AlterTypeDefinition("QuickLinkWidget", builder => builder
.WithPart("QuickLinkWidgetPart")
.WithPart("CommonPart")
.WithPart("WidgetPart")
.WithSetting("Stereotype", "Widget"));
return 23;
}
public class QuickLinkWidgetRecord : ContentPartRecord
{
//We shall not define any property for this class.
//We shall not create any HANDLER for this widget because we do not need to store any data to our database.
}
public class QuickLinkWidgetPart : ContentPart<QuickLinkWidgetRecord>
{
//Again we shall not definte any Record property here......
//We shall not create any HANDLER for this widget because we do not need to store any data to our database.
}
未定义任何内容,因为我没有处理任何存储库。
public class QuickLinkWidgetDriver : ContentPartDriver<QuickLinkWidgetPart>
{
override DriverResult Display(QuickLinkWidgetPart part, string displayType, dynamic shapeHelper)
{
//We do not have any property defined in Model class.
//So we don't have to assign any Default values to anything!
//We shall just return a SHAPE of the widget
}
}
<Place Widgets_QuickLinkWidget="AsideFirst:1" />
@using Emfluence.Intrust.Models;
@model Contact
<h2>Our Side link widget</h2>
我在视图中添加了额外的内容
请帮助我理解我做错了什么。为什么我根本无法看到渲染的小部件?我在最近3天坚持使用它!只是想先看它渲染!
提前感谢您的帮助
答案 0 :(得分:0)
我有类似的问题,我通过更改我的placement.info文件中的一些设置来实现它......在你的情况下试试这个
<Place Widgets_QuickLinkWidget="Content" />