Own DataFormWebPart: Unable to display this Web Part.

Posted by user307852 on Stack Overflow See other posts from Stack Overflow or by user307852
Published on 2010-04-02T18:04:23Z Indexed on 2010/04/02 18:53 UTC
Read the original article Hit count: 928

Filed under:
|

Hi, What I want is to display a paginable list from my custom data source. All came from the fact that I needed some logical relationships between seach scopes and some dates. I considered ContentQueryWebpart, but CAML is too complicated as I have plenty of different conditions, CoreResults webpart is too limited as it uses KeyWordQuery so I inherited from DataFormWebPart to display my own custom search results from my own custom xml source. Thats the best way i am aware of... I knew I needed some configuration to write in my pageLayout like MyWebParts:MyCustomWebPart etc so I went to Designer, put DataFormWebPart on a page, linked it to list of pages, and set multiple item view and that gave me some configuration.. Firstly i checked if DataFormWebPart works when put on pageLayout and it sucessfully displayed my pages list in pages library. But that was not what I wanted, i needed to set my own XML data source... I then changed the configuration of WebPartPages:DataFormWebPart to match mine and detach from any listName or listId and I change the XSL tag to much simplier to display all results and now I am getting:

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.

and there is no way to know what is wrong:/

The webpart

public class MyCustomWebPart : DataFormWebPart{ 
 public override void DataBind()
        {        ......
         XmlDataSource source = new XmlDataSource();
         source.Data = doc.InnerXml;
         this.DataSource=source;
         base.DataBind();
        }
     }

The doc XML:

<dsQueryResponse><Rows><Row 
URL="http://myserver/sites/sc/myDoc.doc" TITLE="Specification.doc" AUTHOR="System.String[]" /></Rows></dsQueryResponse>

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" AutoRefreshInterval="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> 

© Stack Overflow or respective owner

Related posts about sharepoint

Related posts about dataformwebpart