空指针异常(FunctionTypeList.ascx)i用于EPiServer的Composer模块插件

时间:2013-02-20 18:44:06

标签: episerver

我已在IIS 7上部署的EPiServer CMS 6 R2站点上安装了EPiServer的Composer模块。 我已根据说明配置了web.config。 我可以在'Composer edit'模式下查看页面。

当我尝试在Admin-mode(用于注册Composer-blocks)中访问Composer-plugin时出现以下错误。

我该如何解决这个问题?:     '/'应用程序中的服务器错误。     你调用的对象是空的。     描述:执行当前Web请求期间发生未处理的异常。请查看堆栈跟踪,以获取有关错误及其在代码中的起源位置的更多信息。

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:


Line 60:                             <ItemTemplate>
Line 61:                                 <nobr>  
Line 62:                                    <asp:Label ID="Label1" runat="server" 
Line 63:                                         ToolTip ='<%#DataBinder.Eval(Container.DataItem, "Description")%>'
Line 64:                                         Text = '<%# Utils.TrimDescription(DataBinder.Eval(Container.DataItem, "Description").ToString(),20).ToHtmlEncoded()%>'/>         


Source File: c:\EPiServer\Sites\Skien\Dropit\Plugin\Extension\UI\Admin\Controls\FunctionTypeList.ascx    Line: 62

Stack Trace:


[NullReferenceException: Object reference not set to an instance of an object.]
   ASP.dropit_plugin_extension_ui_admin_controls_functiontypelist_ascx.__DataBinding__control19(Object sender, EventArgs e) in c:\EPiServer\Sites\Skien\Dropit\Plugin\Extension\UI\Admin\Controls\FunctionTypeList.ascx:62
   System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +303
   System.Web.UI.Control.DataBindChildren() +12659735
   System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +321
   System.Web.UI.Control.DataBindChildren() +12659735
   System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +321
   System.Web.UI.WebControls.GridView.CreateRow(Int32 rowIndex, Int32 dataSourceIndex, DataControlRowType rowType, DataControlRowState rowState, Boolean dataBind, Object dataItem, DataControlField[] fields, TableRowCollection rows, PagedDataSource pagedDataSource) +295
   System.Web.UI.WebControls.GridView.CreateChildControls(IEnumerable dataSource, Boolean dataBinding) +4780
   System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +95
   System.Web.UI.WebControls.GridView.PerformDataBinding(IEnumerable data) +19
   System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +222
   System.Web.UI.WebControls.DataBoundControl.PerformSelect() +313
   System.Web.UI.Control.DataBindChildren() +12659735
   System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +321
   System.Web.UI.Control.DataBindChildren() +12659735
   System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +321
   System.Web.UI.Control.DataBindChildren() +12659735
   System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +321
   System.Web.UI.Control.DataBindChildren() +12659735
   System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +321
   Dropit.Extension.UI.Admin.Controls.FunctionTypeList.DataBind() +646
   System.Web.UI.Control.LoadRecursive() +71
   System.Web.UI.Control.LoadRecursive() +190
   System.Web.UI.Control.LoadRecursive() +190
   System.Web.UI.Control.LoadRecursive() +190
   System.Web.UI.Control.LoadRecursive() +190
   System.Web.UI.Control.LoadRecursive() +190
   System.Web.UI.Control.LoadRecursive() +190
   System.Web.UI.Control.LoadRecursive() +190
   System.Web.UI.Control.LoadRecursive() +190
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3178


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.17929 

1 个答案:

答案 0 :(得分:1)

post by Mari Jørgensen描述了Composer中某些其他控件的相同问题。

  

如果没有设置Description,EPiServer基本上会返回一个空字符串,而PageTypeBuilder返回null。

解决方案是修改代码行,如果Description为null,则返回string.Empty

<%# Utils.TrimDescription(DataBinder.Eval(Container.DataItem, "Description") as string ?? String.Empty,20).ToHtmlEncoded()%>'/>