1

Closed

通过Feature添加searchWp时出错

description

code:
<View Name="{1B070996-35D0-4443-A718-ACB1F5904F02}" DefaultView="TRUE" MobileView="TRUE" MobileDefaultView="TRUE" Type="HTML"
        WebPartOrder="2" WebPartZoneID="Main"
        DisplayName="所有项目" Url="AllItems.aspx"  BaseViewID="1" ContentTypeID="0x"  SetupPath="pages\viewpage.aspx">

    <ViewFields>
      <FieldRef Name="LinkTitle"/>         
    </ViewFields>
    <Query>
      <OrderBy>
        <FieldRef Name="ID"/>
      </OrderBy>
    </Query>
    <Aggregations Value="On">
      <FieldRef Name="LinkTitle" Type="COUNT"/>
    </Aggregations>
    <RowLimit Paged="TRUE">10</RowLimit>
    <Mobile MobileItemLimit="3" MobileSimpleViewField="LinkTitle"/>
    <Toolbar Type="None"/>
    <XslLink Default="TRUE">main.xsl</XslLink>
    <ParameterBindings>
      <ParameterBinding Name="NoAnnouncements" Location="Resource(wss,noXinviewofY_LIST)"/>
      <ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(wss,noXinviewofY_DEFAULT)"/>
    </ParameterBindings>        
    <WebParts>
      <AllUsersWebPart WebPartZoneID="Main" WebPartOrder="1">
        <![CDATA[
                <WebPart xmlns="http://schemas.microsoft.com/WebPart/v2">
                    <Assembly>$SharePoint.Project.AssemblyFullName$</Assembly>                        <TypeName>CodeArt.SharePoint.SmartQuery.ListQueryWebPart</TypeName>
                    <FrameType>None</FrameType>
                    <IsVisible>true</IsVisible>
                    <Title>Search</Title>                                
               </WebPart>
               ]]>
      </AllUsersWebPart>          
    </WebParts>
error:
Web 部件错误: 默认命名空间“http://schemas.microsoft.com/WebPart/v2”是为基本 Web 部件属性保留的命名空间。自定义 Web 部件属性需要唯一的命名空间(通过属性上的 XmlElementAttribute 或类别上的 XmlRootAttribute 指定)。
Closed May 3, 2013 at 7:22 AM by jianyi
fixed

comments

jianyi wrote May 2, 2013 at 8:25 AM

给BaseSPWebpart制定命名空间即可:
[XmlRoot(Namespace = "http://codeart/WebPart")]
public abstract class BaseSPWebPart : M

jianyi wrote May 2, 2013 at 8:45 AM

并且,需要修改基类为:Microsoft.SharePoint.WebPartPages.WebPart

wrote May 3, 2013 at 7:22 AM

wrote May 16, 2013 at 8:11 AM