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" 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>
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
Related
I have just recently started using .Net MAUI. But now I'm wondering how to use a piece of code, e.g. a self-made navigation bar on all my pages, because it doesn't make sense to write the same code on all 10 pages. I like to know if there is a way to create a component that can be reused like in React or Angular?
PS: This question is not specific to a navigation bar but to the general reuse of code in .NET MAUI.
I have so far watched various videos & articles on this topic, however, it is more about custom controls and did not help me. Most articles corresponded to what was conveyed in this video. I also came across this article, but it didn't help me either.
Thanks for your help :)
First, you can create a new .xaml file named Name.xaml. You can write some codes in it.
<?xml version="1.0" encoding="utf-8" ?>
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="CusComponents.Name">
<ContentView.Content>
<StackLayout Padding="10">
<Label Text="Name" FontAttributes="Bold" />
<Label Text="First name" />
<Entry x:Name="FirstName" Placeholder="First name" />
<Label Text="Last name" />
<Entry x:Name="LastName" Placeholder="Last name" />
</StackLayout>
</ContentView.Content>
</ContentView>
Second, you can use it in the page you want like this. You need to add an xmlns reference to the top of the XML file– this is like a using statement in a C# file. Using the namespace structure for the sample project, this will be xmlns:custom_components="clr-namespace:CusComponents".
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:custom_components="clr-namespace:CusComponents"
x:Class="CusComponents.MainPage">
<custom_components:Name />
</ContentPage>
Here is the view of the code:
What I would like to do is the following:
I'm currently deploying a huge collection of lists and codebehind. But, what I also want to deploy is the 'visual side' of the package. But, currently, this is done using Sharepoint Designer 2010.
My guess is that all the modifications I do in Sharepoint Designer 2010 can be done in one way or another in Visual Studio 2010, using either the Schema.xml of the view, or codebehind. I don't really mind either.
I can't have any static XSL transforming though. My XSL file will be based on the recently added dynamic columns, and I want to start with something like this.
<xsl:include href="/_layouts/xsl/main.xsl"/>
<xsl:include href="/_layouts/xsl/internal.xsl"/>
<xsl:param name="AllRows" select="/dsQueryResponse/Rows/Row[$EntityName = '' or (position() >= $FirstRow and position() <= $LastRow)]"/>
<xsl:param name="dvt_apos">'</xsl:param>
<xsl:template name="FieldRef_User_body.Employee" ddwrt:dvt_mode="body" match="FieldRef[#Name='Employee']" mode="User_body" ddwrt:ghost="" xmlns:ddwrt2="urn:frontpage:internal">
<xsl:param name="thisNode" select="."/>
<span>
<xsl:attribute name="style">
<xsl:if test="normalize-space($thisNode/#Employee) = 'Mats-PC\Mats'" ddwrt:cf_explicit="1">background-color: #DEF0FA;</xsl:if>
</xsl:attribute>
<xsl:value-of disable-output-escaping="yes" select="$thisNode/#*[name()=current()/#Name]" />
</span>
</xsl:template>
To explain, this will set the background colour to something else when the Employee value (Of type User) is equal to 'Mats-PC\Mats'
How would I go and make this dynamic, and add this to that one view? I've looked in the SPView object, and all I see is Xsl and XslLink, but I have no clue what to do with them. Any ideas?
Greetings,
Mats
Grab a copy of SharePoint Manager to get a look at the values of objects in a SharePoint instance. The properties Xsl is usually used to store the Xsl that will be used to render the view, but if a url is provided in XslLink, that will override and pull out the Xsl from there. You may have trouble with xsl some includes because of SharePoint security.
I have the following Feature:
<?xml version="1.0" encoding="utf-8"?>
<Feature Id="9A3C5D02-A2EB-4725-97F7-CDA6DE319F1B"
Title="My Custom Types"
Scope="Site"
DefaultResourceFile="core"
Hidden="TRUE"
xmlns="http://schemas.microsoft.com/sharepoint/">
<ElementManifests>
<ElementManifest Location="Elements.xml" />
<ElementFile Location="templates/MeetingMinutes.docx" />
</ElementManifests>
</Feature>
Which contains the following Elements.xml:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Module Name="Templates" Url="_cts/Meeting Minutes" Path="templates" RootWebOnly="TRUE">
<File Url="MeetingMinutes.docx" Type="Ghostable" />
</Module>
<ContentType
ID="0x01010066DD088A6B8B46BCA775CCD119FBB3E8"
Name="Meeting Minutes"
Group="Custom Content Types"
Version="0">
<FieldRefs />
<DocumentTemplate TargetName="MeetingMinutes.docx"/>
</ContentType>
</Elements>
I then use this ContentType within a custom List Template:
<ContentTypes>
<ContentTypeRef ID="0x0101">
<Folder TargetName="Forms/Document" />
</ContentTypeRef>
<ContentTypeRef ID="0x01010066DD088A6B8B46BCA775CCD119FBB3E8">
<Folder TargetName="Forms/Document" />
</ContentTypeRef>
<ContentTypeRef ID="0x0120" />
</ContentTypes>
I deploy the solution, activate the feature, and create an instance of the List Template. I go into the library and select Settings > Document Library Settings > Content Types: Meeting Minutes > Parent: Meeting Minutes > Advanced settings. I'm now in the Advance Settings of the Site Content Type. The URL of the existing document template is MeetingMinutes.docx and there is an (Edit Template) link which points to http://myserver/sites/testsite/_cts/Meeting%20Minutes/MeetingMinutes.docx. Everything's shiny.
But, I hit the back button two times so I'm back in the settings of the List Content Type. This time when I click Advance settings, the URL of the existing document template is still MeetingMinutes.docx, but there is no (Edit Template) link. Troubling.
Pressing on, I go back to AllItems.aspx and click New > Meeting Minutes. As Word is loading, I see a little Opening dialog which says, Opening: http://myserver/sites/testsite/Shared%20Documents/Forms/Document/MeetingMinutes.docx, to which Word responds: "Word was unable to read this document. It may be corrupt."
So the Document Template works correctly in the Site Content Type (where it does me no good), but is not working in the List Content Type (where I really need it). Now, I know I could put this in _layouts, but from what I've read, _cts is the way to do it. What am I doing wrong?
Rich, I'm not exactly sure what's going on because I created a feature using your feature and elements files as you specified and it works correctly for me.
There is one difference though.
When I create a new document in the library from the content type, the template url is
http://myserver/sites/testsite/Shared%20Documents/Forms/Meeting Minutes/MeetingMinutes.docx
Not
http://myserver/sites/testsite/Shared%20Documents/Forms/Document/MeetingMinutes.docx
Somehow your content type seems to be looking in the wrong folder for the template. I hope that gives you some clues.
I had the same exact problem with document template for List Content Type.
What I did is just what SharePoint do when you create your library from web site : duplicate the document template inside the “Forms” folder of the library in a subfolder that have the same name than the content type.
You just need to add a module element somewhere in your project :
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Module Name="MeetingMinutesListInstanceTemplate" Url="Shared Documents/Meeting Minutes" Path="templates" RootWebOnly="TRUE">
<File Url="MeetingMinutes.docx" Type="Ghostable" />
</Module>
</Elements>
It worked for me.
I have a feature that automatically creates some web part pages. I want to display a list in my web part page but I can't get the list to show up. Here is my code in my element.xml file:
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Module Path="PageTemplates" Url="" >
<File Url="Tab3.aspx" Name="Tab3.aspx" Type="Ghostable" >
<View List="Lists/Links"
BaseViewID="0"
WebPartZoneID="Left"
WebPartOrder="0"/>
</File>
</Module>
</Elements>
I know i set up the page correctly because I put the following content editor web part into the page and it shows up:
<AllUsersWebPart WebPartZoneID="Left" WebPartOrder="0">
<![CDATA[
<WebPart xmlns="http://schemas.microsoft.com/WebPart/v2"
xmlns:cewp="http://schemas.microsoft.com/WebPart/v2/ContentEditor">
<Assembly>Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>
<TypeName>Microsoft.SharePoint.WebPartPages.ContentEditorWebPart</TypeName>
<Title>Some content that you want to provision with the feature</Title>
<FrameType>TitleBarOnly</FrameType>
<cewp:Content>
Hello world.
</cewp:Content>
</WebPart>
]]>
</AllUsersWebPart>
I'm getting the following error in the log: Not enough information to determine a list for module "(null)". Assuming no list for this module.
What am I doing wrong?
More details:
When I use
<View List="Lists/Links"...>
I get no error but nothing shows up on my page. if I enter a bogus list name I get the following error:
Cannot complete this action.
Please try again. at Microsoft.SharePoint.Library.SPRequestInternalClass.EnableModuleFromXml(String bstrFeatureDirectory, String bstrUrl, String bstrXML)
at Microsoft.SharePoint.Library.SPRequest.EnableModuleFromXml(String bstrFeatureDirectory, String bstrUrl, String bstrXML)
I don't believe the previous error I quoted is related to my problem. The error I posted before was
I believe I need to create a ListInstance element in elements.xml file of my feature. I added the following to the top of my file:
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<ListInstance
FeatureId="6A9FB262-8EAD-46C1-814B-7FED72D34EBF"
Id="Links"
Url="Links"
Title="Links"
TemplateType="103"/>
....
I get the following error:
Failed to find a suitable list for tag in module for file 'Tab3.aspx' given List attribute 'Links'.
Where is that list located? You may need to specify the web name, probably by Guid. If 'lists' is the web then once you reference this you only need the list name, i.e. 'links'
My solution was to create the page in Sharepoint Designer and then copy the code into the feature aspx page.
I have this feature
<?xml version="1.0" encoding="utf-8"?>
<Feature Id="c54f20d8-1ad1-49b8-aff7-2c874dd2f45a"
Title="MyCompany Content Types"
Description="Content Types required for MyCompany Provided Applications and Functionality"
Version="12.0.0.0"
Hidden="FALSE"
Scope="Site"
DefaultResourceFile="core"
xmlns="http://schemas.microsoft.com/sharepoint/">
<ElementManifests>
<ElementManifest Location="siteColumns.xml"/>
</ElementManifests>
</Feature>
Here is the contents of siteColumns.xml
<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Field
ID="{1F343F02-22D9-45b8-A2A8-CEB2619A28C4}"
Name="AllowSubstDelivery"
DisplayName="AllowSubstDelivery"
Type="Boolean"
Format="TRUE"
Group="MyCustomGroup"
/>
</Elements>
The feature installs and activates, without producing an error, but the siteColumn is nowhere to be found, any ideas why this site column is not visible?
I checked the logs, no errors reported either.
Hmmm... it looks like you have done everything correctly. Did you copy and paste the ID for the Field from anywhere? If so, the ID may already be in use causing your Field provision to be ignored.
I find the best way to create a Feature defining Site Columns and Content Types is to prototype everything using the Web interface and then copy and paste the generated CAML into your Visual Studio projects. I recorded a short video demonstrating the process that you may find valuable.
SharePoint Site Columns and Content Types via a Feature
What does Format="TRUE" mean?
Doesn't look like it's according to documentation.
Field Element Documentation doesn't tell you much about those properties, however there is much in common with FieldRef element and it has documentation about Format attribute.
Maybe you wanted to use DefaultValue attribute?