2011-11-22 17 views
0

我想借此機會在此問一個問題,因爲我確實無法找到此問題的根本原因。無法在自定義列表窗體上顯示Web部件錯誤(新建項目)

我正在使用SPD 2007的WSS 3.0網站上工作,對於一般的Sharepoint開發我相當新。

我正在自定義DispForm.aspx頁面。該頁面是一個簡單的編輯頁面,但最後,我添加了一個自定義列表表單Web部件,用於添加註釋(存儲在另一個列表中)和下面的註釋,用於查看與DispForm.aspx顯示的項目關聯的註釋的數據視圖頁。

什麼我想要做的類似於此頁面上顯示的功能,我從它的啓發自己,你其實可以看到我的意見是最新的一個: http://sharepoint.microsoft.com/blogs/GetThePoint/Lists/Posts/Post.aspx?ID=209

一切工作,直到我刪除所有我作爲測試所做的評論。現在我從自定義列表表單中獲得的是「無法顯示此Web部件錯誤」。

我已經看過日誌,我明白它在抱怨什麼,但我不知道如何解決它,甚至不知道爲什麼會有這樣的錯誤開始。

SPDataSourceView.ExecuteSelect() - selectArguments: IsEmpty=True, MaximumRows=0, RetrieveTotalRowCount=False, SortExpression=, StartRowIndex=0, TotalRowCount=-1 
Error while executing web part: System.InvalidOperationException: Unable to open the specified list item. ---> 
System.ArgumentException: **Value does not fall within the expected range**.  
at Microsoft.SharePoint.SPList.**GetItemById**(Int32 id, String strRootFolder, Boolean cacheRowsetAndId)  
at Microsoft.SharePoint.SPList.GetItemById(Int32 id)  
at Microsoft.SharePoint.WebControls.SPDataSourceView.ExecuteSelect(DataSourceSelectArguments selectArguments)  --- End of inner exception stack trace ---  
at Microsoft.SharePoint.WebControls.SPDataSourceView.ExecuteSelect(DataSourceSelectArguments selectArguments)  
at System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback)  
at Microsoft.SharePoint.WebControls.SingleDataSource.GetXPathNavigatorInternal()  
at Microsoft.SharePoint.WebControls.SingleDataSource.GetXPathNavigator()  
at Microsoft.SharePoint.WebControls.SingleDataSource.GetXPathNavigator(IDataSource datasource, Boolean originalData)  
at Microsoft.SharePoint.WebPartPages.DataFormWebPart.GetXPathNavigator(String viewPath)  
at Microsoft.SharePoint.WebPartPages.DataFormWebPart.PrepareAndPerformTransform() 
InnerException 1: System.ArgumentException: Value does not fall within the expected range.  
at Microsoft.SharePoint.SPList.GetItemById(Int32 id, String strRootFolder, Boolean cacheRowsetAndId)  
at Microsoft.SharePoint.SPList.GetItemById(Int32 id)  
at Microsoft.SharePoint.WebControls.SPDataSourceView.ExecuteSelect(DataSourceSelectArguments selectArguments) 

我們在談論一個「新項目」的形式,所以我不明白爲什麼我在GetItemById得到一個錯誤。它試圖得到什麼,我該如何解決它?

最後,我還沒有改變由SPD創建的CAML查詢。我確實改變了評論列表,例如重命名或刪除未使用的列,但我不認爲這是問題的原因,因爲刪除自定義列表並重新創建它並沒有解決問題。

任何線索,關於我應該在哪裏或什麼?我剛剛從創意中脫穎而出。

謝謝。

回答

1
  1. 在Sharepoint Designer中,打開將「註釋」自定義列表表單插入到的DispForm。
  2. 在代碼視圖中,找到列表的DataFormWebPart。
  3. 找到行<SharePoint:SPDataSource runat="server" DataSourceMode="ListItem"和改變DataSourceModeDataSourceMode="List"
  4. 裏面的ParameterBindings的,發現<ParameterBinding Name="ListItemId".....並將其更改爲<ParameterBinding Name="ListItemId" Location="None" DefaultValue="0"/>
相關問題