Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11508

VisualWebPart - Adding to schema.xml

$
0
0

Hi guys,

I have one question regarding to add a visual web part to a Schema.XML.

If I have this visual Webpart:

<?xml version="1.0" encoding="utf-8"?><webParts><webPart xmlns="http://schemas.microsoft.com/WebPart/v3"><metaData><type name="SharePoint_Z_Drive_Project.WP_ErrorField.WP_ErrorField, $SharePoint.Project.AssemblyFullName$" /><importErrorMessage>$Resources:core,ImportErrorMessage;</importErrorMessage></metaData><data><properties><property name="Title" type="string">Error</property><property name="Description" type="string">Error Field WebPart</property></properties></data></webPart></webParts>

How do I have to add it to the Schema.xml of a list Definition in the forms area?

I tried this way:

<Form Type="EditForm"
            SetupPath="pages\form.aspx"
            WebPartZoneID="Main"
            Url="MyEditForm.aspx"
            Default="TRUE"><WebParts><AllUsersWebPart WebPartZoneID="Main" WebPartOrder="1"><![CDATA[<WebPart xmlns="http://schemas.microsoft.com/WebPart/v3"><Assembly>$SharePoint.Project.AssemblyFullName$, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly> <TypeName="SharePoint_Z_Drive_Project.WP_ErrorField.WP_ErrorField, $SharePoint.Project.AssemblyFullName$"></TypeName><FrameType>None</FrameType></WebPart>
            ]]></AllUsersWebPart></WebParts>     </Form>

Is there something wrong?

Because when I edit an item in the list, I got this error message:

Web Part Error: The file you imported is not valid. Verify that the file is a Web Part description file (*.webpart or *.dwp) and that it contains well-formed XML.

Error Details:
[WebPartPageUserException: The file you imported is not valid. Verify that the file is a Web Part description file (*.webpart or *.dwp) and that it contains well-formed XML.]
  at Microsoft.SharePoint.WebPartPages.WebPartImporter.CreateXdoc(XmlReader reader) 
  at Microsoft.SharePoint.WebPartPages.WebPartImporter..ctor(SPWebPartManager manager, XmlReader reader, Uri webPartPageUri, SPWeb spWeb) 
  at Microsoft.SharePoint.WebPartPages.WebPartImporter.Import(SPWebPartManager manager, XmlReader reader, Boolean clearConnections, Uri webPartPageUri, SPWeb spWeb) 
  at Microsoft.SharePoint.WebPartPages.SPWebPartManager.CompressWebPartNoSave(Boolean isClosed)  
 
 

But I think, the WebPart itself is working  fine. When I open the WebPart via Site Settings, there is no error and the WebPart is displayed correctly.

What I'm doing wrong? Can anybody help?

Thanks in advance.

Dennis


Viewing all articles
Browse latest Browse all 11508

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>