【问题标题】:Kentico v8 Uniselector not selecting custom document typesKentico v8 Uniselector 未选择自定义文档类型
【发布时间】:2014-08-04 00:51:54
【问题描述】:

我们需要输入什么对象类型才能在 Kentico v8 的 Uniselector 控件中选择自定义文档类型?

在 Kentico v7.0.34 中,我们成功地使用 UniSelector 来选择自定义文档类型,如下所示;

  • 对象类型:customtableitem.custom.Course
  • 返回列名:CourseID
  • 显示名称格式:{%Name%}
  • 选择模式:多个
  • 订购者:姓名

但是,在 Kentico v8.0.17 中,使用上述值时出现以下错误;

[CustomTableItemProvider.GetTypeInfo]:“custom.course”类不是自定义表格。

Server Error in '/' Application.
[CustomTableItemProvider.GetTypeInfo]: Class 'custom.course' is not custom table.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Exception: [CustomTableItemProvider.GetTypeInfo]: Class 'custom.course' is not custom table.

Source Error:


Line 1094:    private void LoadObjects()
Line 1095:    {
Line 1096:        if (Object != null)
Line 1097:        {
Line 1098:            // Reset string builder


Source File: c:\Visual Studio\Projects\Kentico8\CMS\CMSAdminControls\UI\UniSelector\UniSelector.ascx.cs    Line: 1096 

我们已尝试如下更改对象类型;

  • 对象类型:custom.Course

这个结果是下面的错误;

找不到对象类型“custom.course”。

Server Error in '/' Application.
Object type 'custom.course' not found.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Exception: Object type 'custom.course' not found.

Source Error:


Line 1094:    private void LoadObjects()
Line 1095:    {
Line 1096:        if (Object != null)
Line 1097:        {
Line 1098:            // Reset string builder


Source File: c:\Visual Studio\Projects\Kentico8\CMS\CMSAdminControls\UI\UniSelector\UniSelector.ascx.cs    Line: 1096 

我已阅读文档available here,对于对象类型,它提供了“cms.user”的示例值。将对象类型设置为“cms.user”确实适用于选择 CMS 用户。

我还创建了一个名为“Test”的自定义表,并且可以确认将对象类型设置为“customtableitem.customtable.Test”对于选择自定义表项确实有效。

我也在 Kentico 的 dev.net Q&A 网站上问过这个问题; https://devnet.kentico.com/questions/uniselector-in-kentico-v8

干杯,

达伦

【问题讨论】:

    标签: kentico


    【解决方案1】:

    快速回答:

    ObjectType: cms.documenttype
    Return column name: ClassID
    Display name format: {%ClassDisplayName%}
    

    长答案: 文档类型定义(以及自定义表和在线表单定义)位于 CMS_Class 表中。要检索它们,您可以使用更通用的 "cms.class" 或更具体的 "cms.documenttype""cms.customtable" 对象类型。所以你应该可以使用 ObjectType: cms.class + Where condition: ClassIsDocumentType=1 来做同样的事情。

    您一直在尝试做的是检索数据,而不是数据的类定义。所谓“类”的数据存储在它们自己的表中。每个自定义表格都有自己的表格,每个在线表格都有自己的表格,文档存储在CMS_TreeNode/CMS_Document 表格中。

    顺便说一句 - 已经有一个用于选择类的表单控件。看看:

     \CMS\CMSFormControls\Classes\SelectClassNames.ascx
    

    为了区分自定义类和预定义类,我建议为您的对象使用一些前缀并使用ClassName LIKE "myprefix%" 选择它们,或者简单地使用id 条件ClassID > 4478

    【讨论】:

    • 感谢 rocky,这看起来像是我需要的信息。我正在尝试从自定义文档类型中选择数据。我会试试看。
    • 我担心我的问题可能会误导您,我确实想选择多个文档而不是多个 DocumentTypes(类名)。 Kentico Support 提供了答案。 devnet.kentico.com/questions/uniselector-in-kentico-v8
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-03-04
    • 1970-01-01
    • 1970-01-01
    • 2016-03-02
    相关资源
    最近更新 更多