Pdf文档链接控制错误 - PdfDocumentLink.ascx

时间:2014-04-30 14:32:08

标签: sitefinity

我刚刚从5.1升级到7.0,现在我在其中一个具有PdfDocumentLink控件的页面上出现此错误(在编辑模式下):

在"〜/ Sitefinity / Extensions / WidgetTemplates / Libraries / Documents / PdfDocumentLink.ascx"的模板中找不到所需的控件。控件必须可以从类型" System.Web.UI.HtmlControls.HtmlGenericControl"中分配。并且必须有ID" itemsContainer"。

我在预览模式下得到500。

这是ascx的代码,位于\ Sitefinity \ Extensions \ WidgetTemplates \ Libraries \ Documents

<%@ Control Language="C#" %>
<%@ Register TagPrefix="sitefinity" Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI" %>
<%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI.PublicControls.BrowseAndEdit" Assembly="Telerik.Sitefinity" %>
<sitefinity:ResourceLinks id="resourcesLinks2" runat="server" UseEmbeddedThemes="false" Theme="Default">

  <sitefinity:ResourceFile Name="~/Sitefinity/Extensions/WidgetTemplates/Libraries/Documents/PdfDocumentLink.css" Static="true"  /> 
</sitefinity:ResourceLinks>
<sitefinity:SitefinityHyperLink ID="documentLink" runat="server" target="_blank" CssClass="PdfDocumentLink" />
<sf:BrowseAndEditToolbar ID="browseAndEditToolbar" runat="server" Mode="Edit"></sf:BrowseAndEditToolbar>

这里是cs文件...在C:\ inetpub \ xxx \ App_Code \ Widgets

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;


namespace xxx.Sitefinity.Widgets.Libraries.Documents {
    /// <summary>
    /// Summary description for PdfDocumentLink
    /// </summary>
    public class PdfDocumentLink : Telerik.Sitefinity.Modules.Libraries.Web.UI.Documents.DocumentLink {
        public PdfDocumentLink() : base () {
            //
            // TODO: Add constructor logic here
            //
        }

        public override string LayoutTemplatePath {
            get {
                return "~/Sitefinity/Extensions/WidgetTemplates/Libraries/Documents/PdfDocumentLink.ascx";
            }
            set {
                base.LayoutTemplatePath = value;
            }
        }

        public string LinkTitle {
            get;
            set;
        }

        protected override void OnPreRender(EventArgs e) {
            base.OnPreRender(e);
            if (this.LinkTitle != null)
            this.DocumentLinkControl.Text = this.LinkTitle;
        }
    }
}

和ToolboxesConfig.config文件:

  ...
    <toolboxesConfig xmlns:config="urn:telerik:sitefinity:configuration" xmlns:type="urn:telerik:sitefinity:configuration:type" config:version="7.0.5100.0">
        <toolboxes>
            <toolbox name="PageControls">
                <sections>
                    <add name="ContentToolboxSection">
                        <tools>...
                            <add enabled="True" type="OneCommand.Sitefinity.Widgets.Libraries.Documents.PdfDocumentLink" title="PDF Document Link" description="Link to a PDF Document" cssClass="sfDownloadLinkIcn" moduleName="Libraries" Name="PDFDocumentLink" visibilityMode="None" name="PDFDocumentLink" />

如果我删除了小部件,并将其重新添加,并选择了一个pdf文档,我会收到同样的错误。

“文档链接”窗口小部件似乎正常工作,但是我们没有要显示的左侧PDF图标。

有什么想法吗?

1 个答案:

答案 0 :(得分:1)

尝试将此添加到.ascx文件中:

<div runat="server" id="itemsContainer"></div>