sharepoint 2010 XsltListViewWebPart Inside Overview

XsltListView has less setting than DataFormWebpart, and we can just override some xsl template to customize it.

it is very useful improvement in sharepoint 2010, so just let us go into it.

1. no more spdatasource , xmldefinition replace of it



<XmlDefinition>
	<View Name="{420E5B2A-8C2C-4465-BB7D-8E27EDB25F49}" MobileView="TRUE" Type="HTML" DisplayName="All Items" Url="/Lists/Products/AllItems.aspx" Level="1" BaseViewID="1" ContentTypeID="0x" ImageUrl="/_layouts/images/generic.png">
		<Query/>
		<ViewFields>
			<FieldRef Name="LinkTitle"/>
			<FieldRef Name="IconUrl"/>
			<FieldRef Name="FullTitle"/>
		</ViewFields>
		<RowLimit Paged="TRUE">30</RowLimit>
		<Aggregations Value="Off"/>
		<Toolbar Type="Standard"/>
	</View>
</XmlDefinition>

2. Property ListUrl , it can support use url to specify the list instead of list guid.

3. override xsl to customize your look and feel

<xsl:stylesheet xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" version="1.0" exclude-result-prefixes="xsl msxsl ddwrt" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:SharePoint="Microsoft.SharePoint.WebControls" xmlns:ddwrt2="urn:frontpage:internal" xmlns:o="urn:schemas-microsoft-com:office:office">
    <xsl:include href="/_layouts/xsl/main.xsl"/>
    <xsl:include href="/_layouts/xsl/internal.xsl"/>
 
</xsl:stylesheet>

Overrided:

  <xsl:stylesheet xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" version="1.0" exclude-result-prefixes="xsl msxsl ddwrt" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:SharePoint="Microsoft.SharePoint.WebControls" xmlns:ddwrt2="urn:frontpage:internal" xmlns:o="urn:schemas-microsoft-com:office:office">
    <xsl:include href="/_layouts/xsl/main.xsl"/>
    <xsl:include href="/_layouts/xsl/internal.xsl"/>
    
    <xsl:template name="FieldRef_header" ddwrt:dvt_mode="header" match="FieldRef" mode="header">
      <th nowrap="nowrap" scope="col" οnmοuseοver="OnChildColumn(this)">
        Hello World!
      </th>
    </xsl:template>
    
 </xsl:stylesheet>

And it looks like:

2011041417314193.png

转载于:https://www.cnblogs.com/frankzye/archive/2011/04/14/2016279.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值