查看 NuGet 包中包含的页面类型类和提供程序,您可以使用以下代码在事件日历页面下插入新页面。
var parentPage = EventCalendarProvider.GetEventCalendars()
.TopN(1)
.Culture("en-GB")
.Published()
.LatestVersion()
.FirstOrDefault();
var newEvent = new Event
{
EventName = "Test Event",
EventSummary = "Summary Text",
EventDescription = "Test Description",
EventLocation = "Somewhere",
EventStart = DateTime.Now,
EventIsAllDay = true,
// ...etc for the rest of the properties coming from the Kentico Form you've created.
};
newEvent.Insert(parentPage);
如果你还没有探索过,你可以使用BizFormItemEvents来拦截表单提交并使用上面的代码插入页面。