我在一个非常简单的webpart中实现了SharePoint:DateTimeControl
<SharePoint:DateTimeControl ID="dtStartdate" runat="server" DateOnly="true" />
问题是当我点击控件时它会呈现异常
Server Error in '/' Application. Object reference not set to an instance of an object. 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.NullReferenceException: Object reference not set to an instance of an object. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [NullReferenceException: Object reference not set to an instance of an object.] Microsoft.SharePoint.Utilities.SPUtility.GetThemedImageUrl(String originalUrl, String themeKey) +199 Microsoft.SharePoint.WebControls.DatePicker..ctor() +1460 Microsoft.SharePoint.WebControls.SPDatePickerControl.InitDatePicker() +44 Microsoft.SharePoint.WebControls.SPDatePickerControl.set_MinJDay(Int32 value) +25 Microsoft.SharePoint.ApplicationPages.DatePickerFrame.Page_Load(Object sender, EventArgs e) +1708 System.EventHandler.Invoke(Object sender, EventArgs e) +0 System.Web.UI.Control.LoadRecursive() +94 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2935 Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.17929
非常感谢任何有关解决此问题的建议或帮助,谢谢!
答案 0 :(得分:1)
我知道自从你提出这个问题已经有一段时间了,但我刚刚解决了一些非常相似的事情,我以为我会分享我的(简单)解决方案。
确保您在网络应用的根目录中创建了网站集。
我正在http:// webapp / sites / mysitecollection中处理Web部件,并出现上述错误。看看http:// webapp给了我404,所以我创建了一个根网站集,现在我的sitecollection中的datepicker工作正常。