Own DataFormWebPart: Unable to display this Web Part
Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Microsoft SharePoint Foundation-compatible HTML editor such as Microsoft SharePoint Designer. If the problem persists, contact your Web server administrator.
The webpart is in PageLayout, inserted without webpartzone:
<MyWebParts:MyCustomWebPart runat="server" Description="" ListDisplayName="" PartOrder="2" HelpLink="" AllowRemove="True" IsVisible="True" AllowHide="True" UseSQLDataSourcePaging="True" ExportControlledProperties="True" DataSourceID="" Title="" ViewFlag="0" NoDefaultStyle="TRUE" AllowConnect="True" FrameState="Normal" PageSize="10" PartImageLarge="" AsyncRefresh="True" ExportMode="All" Dir="Default" DetailLink="" ShowWithSampleData="False" FrameType="None" PartImageSmall="" IsIncluded="True" SuppressWebPartChrome="False" AllowEdit="True" ManualRefresh="False" ChromeType="None" AutoRefresh="False" AutoRefreshInterva开发者_如何转开发l="60" AllowMinimize="True" ViewContentTypeId="" InitialAsyncDataFetch="False" MissingAssembly="Cannot import this Web Part." HelpMode="Modeless" ListUrl="" ID="g_c2180fb9_c667_42f3_aab3_c3340cb0ac5a" ConnectionID="00000000-0000-0000-0000-000000000000" AllowZoneChange="True" IsIncludedFilter="" __MarkupType="vsattributemarkup" __WebPartId="{C2233FB9-C667-42F3-AAB3-C334223C5A}" __AllowXSLTEditing="true" WebPart="true" Height="" Width=""> <Xsl> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:template match="/"> <xmp> <xsl:copy-of select="*"/> </xmp> </xsl:template> </xsl:stylesheet> </Xsl> <DataSources> <SharePoint:SPDataSource runat="server" DataSourceMode="List" SelectCommand="<View></View>" UpdateCommand="" InsertCommand="" DeleteCommand="" UseInternalName="True" ID="spdatasource3"> <SelectParameters> <asp:Parameter DefaultValue="0" Name="StartRowIndex"></asp:Parameter><asp:Parameter DefaultValue="0" Name="nextpagedata"> </asp:Parameter><asp:Parameter DefaultValue="10" Name="MaximumRows"></asp:Parameter> </SelectParameters> </SharePoint:SPDataSource> </DataSources> </MyWebParts:MyCustomWebPart>
I will give you 3 suggestions:
- Implement error handling. At least by encapsulate you code in a try/catch block. Output the error to something like a Literal object in your web part.
- Attach your Visual Studio debugger to the IIS process. Set a breakpoint in your constructor or load method and step through your code from there.
- Look in the WSS log files to see if it says something of interest.
The problem was missing resourceId and secondly i disabled cache-ing on xmlDataSource variable because it showed always the same results but queries were different
Now problem is paging - in MyWebParts:MyCustomWebPart you see PageSize, I set it to 1 but I see 5 items on my list - whats wrong? Is my XMLDataSource wrong somehow?
Moreover - is it possible to convert what is written above (MyWebParts:MyCustomWebPart) to .webpart file so that it could be reusable on othere pageLayouts .. ?
I have noticed that you have the PageSize set to 10 in the initial MyWebParts:MyCustomWebPart and in the SharePoint:SPDataSource you have an entry
<asp:Parameter DefaultValue="10" Name="MaximumRows"/>
Try setting the SPDataSource value to 1.
Jonathan
精彩评论