如何在Sharepoint 2010中的水平视图中创建数据视图?

时间:2015-10-15 19:55:34

标签: sharepoint-2010 dataviewwebpart

<WebPartPages:DataFormWebPart runat="server" Description="" ListDisplayName="" PartOrder="2" HelpLink="" AllowRemove="True" IsVisible="True" AllowHide="True" UseSQLDataSourcePaging="True" ExportControlledProperties="True" IsIncludedFilter="" DataSourceID="" Title="Top Rated" ViewFlag="8" NoDefaultStyle="TRUE" AllowConnect="True" FrameState="Normal" PageSize="6" PartImageLarge="" AsyncRefresh="True" ExportMode="All" Dir="Default" DetailLink="" ShowWithSampleData="False" ListId="2cbf2d40-f565-4efb-8b30-172952842953" ListName="{2CBF2D40-F565-4EFB-8B30-172952842953}" FrameType="None" PartImageSmall="" IsIncluded="True" SuppressWebPartChrome="False" AllowEdit="True" EnableOriginalValue="False" ChromeType="None" AutoRefresh="False" AutoRefreshInterval="60" AllowMinimize="True" ViewContentTypeId="" InitialAsyncDataFetch="False" MissingAssembly="Cannot import this Web Part." HelpMode="Modeless" ListUrl="" ID="g_92f407c0_0e99_48dd_9285_5d4a83c57f31" ConnectionID="00000000-0000-0000-0000-000000000000" AllowZoneChange="True" ManualRefresh="False" __MarkupType="vsattributemarkup" __WebPartId="{92F407C0-0E99-48DD-9285-5D4A83C57F31}" __AllowXSLTEditing="true" WebPart="true" Height="" Width=""><ParameterBindings>

<ParameterBinding Name="ListID" Location="None" DefaultValue="{2CBF2D40-F565-4EFB-8B30-172952842953}"/>

<ParameterBinding Name="dvt_apos" Location="Postback;Connection"/>

<ParameterBinding Name="ManualRefresh" Location="WPProperty[ManualRefresh]"/>

<ParameterBinding Name="UserID" Location="CAMLVariable" DefaultValue="CurrentUserName"/>

<ParameterBinding Name="Today" Location="CAMLVariable" DefaultValue="CurrentDate"/>

<ParameterBinding Name="dvt_firstrow" Location="Postback;Connection"/>

<ParameterBinding Name="dvt_nextpagedata" Location="Postback;Connection"/>

<ParameterBinding Name="dvt_startposition" Location="Postback" DefaultValue=""/>

</ParameterBindings>

<DataFields>@FileLeafRef,Name (for use in forms);@FileDirRef,Path;@FSObjType,Item Type;@PreviewExists,Preview Exists;@_ModerationStatus,Approval Status;@ThumbnailExists,Thumbnail Exists;@File_x0020_Type,File Type;@Title,Title;@ImageWidth,Width;@ImageHeight,Height;@ImageCreateDate,Date Picture Taken;@FileRef,URL Path;@HTML_x0020_File_x0020_Type,HTML File Type;@_UIVersion,UI Version;@_HasCopyDestinations,Has Copy Destinations;@Keywords,Keywords;@AlternateThumbnailUrl,Preview Image URL;@MediaLengthInSeconds,Length (seconds);@VideoWidthInPixels,Frame Width;@VideoHeightInPixels,Frame Height;@UNCPath,UNCPath;@AverageRating,Rating (0-5);@RatingCount,Number of Ratings;@Body10,Body;@Contact,Contact;@Notes0,Notes;@VideoStartDate,Video Start Date;@VideoEndDate,Video End Date;@Featured,Featured;@NewColumn1,Channel;@NewColumn1_x003a_ID,Channel:ID;@Duration,Duration;@Transcript,Transcript;@External_x0020_Link,External Link;@ID,ID;@ContentType,Content Type;@Created,Created;@Author,Created By;@Modified,Modified;@Editor,Modified By;@_CopySource,Copy Source;@CheckoutUser,Checked Out To;@_CheckinComment,Check In Comment;@CheckedOutTitle,Checked Out To;@CheckedOutUserId,ID of the User who has the item Checked Out;@IsCheckedoutToLocal,Is Checked out to local;@_SourceUrl,Source URL;@ContentTypeId,Content Type ID;@Created_x0020_Date,Created;@File_x0020_Size,File Size;@ItemChildCount,Item Child Count;@FolderChildCount,Folder Child Count;@_UIVersionString,Version;@ParentVersionString,Source Version (Converted Document);@ParentLeafName,Source Name (Converted Document);</DataFields>

<Xsl>

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

<xsl:output method="html" indent="no"/>

<xsl:decimal-format NaN=""/>

<xsl:param name="dvt_apos">&apos;</xsl:param>

<xsl:param name="ManualRefresh"></xsl:param>

<xsl:param name="dvt_firstrow">1</xsl:param>

<xsl:param name="dvt_nextpagedata" />

<xsl:param name="Today">CurrentDate</xsl:param>

<xsl:variable name="dvt_1_automode">0</xsl:variable>







<xsl:template match="/" xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:SharePoint="Microsoft.SharePoint.WebControls">

<xsl:choose>

<xsl:when test="($ManualRefresh = 'True')">

<table width="100%" border="0" cellpadding="0" cellspacing="0">

<tr>

<td valign="top">

<xsl:call-template name="dvt_1"/>

</td>

<td width="1%" class="ms-vb" valign="top">

<img src="/_layouts/images/staticrefresh.gif" id="ManualRefresh" border="0" onclick="javascript: {ddwrt:GenFireServerEvent('__cancel')}" alt="Click here to refresh the dataview."/>

</td>

</tr>

</table>

</xsl:when>

<xsl:otherwise>

<xsl:call-template name="dvt_1"/>

</xsl:otherwise>

</xsl:choose>

</xsl:template>

<xsl:template name="dvt_1.empty">

<xsl:variable name="dvt_ViewEmptyText">There are no items to show in this view.</xsl:variable>

<table border="0" width="100%">

<tr>

<td class="ms-vb">

<xsl:value-of select="$dvt_ViewEmptyText"/>

</td>

</tr>

</table>

</xsl:template>

<xsl:template name="dvt_1">

<xsl:variable name="dvt_StyleName">Table</xsl:variable>

<xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row" />

<xsl:variable name="dvt_RowCount" select="count($Rows)" />

<xsl:variable name="RowLimit" select="6" />

<xsl:variable name="FirstRow" select="$dvt_firstrow" />

<xsl:variable name="LastRow" select="$FirstRow + $dvt_RowCount - 1" />

<xsl:variable name="IsEmpty" select="$dvt_RowCount = 0" />

<xsl:variable name="dvt_IsEmpty" select="$dvt_RowCount = 0" />



<xsl:choose>

<xsl:when test="$dvt_IsEmpty">

<xsl:call-template name="dvt_1.empty" />

</xsl:when>

<xsl:otherwise><table border="0" width="100%" cellpadding="2" cellspacing="0">

<tr valign="top">

<xsl:if test="$dvt_1_automode = '1'" ddwrt:cf_ignore="1">

<th class="ms-vh" width="1%" nowrap="nowrap" />

</xsl:if>

</tr>

<xsl:call-template name="dvt_1.body">

<xsl:with-param name="Rows" select="$Rows" />

<xsl:with-param name="FirstRow" select="1" />

<xsl:with-param name="LastRow" select="$LastRow - $FirstRow + 1" />

</xsl:call-template>

</table></xsl:otherwise>

</xsl:choose>

<xsl:call-template name="dvt_1.commandfooter">

<xsl:with-param name="FirstRow" select="$FirstRow" />

<xsl:with-param name="LastRow" select="$LastRow" />

<xsl:with-param name="RowLimit" select="$RowLimit" />

<xsl:with-param name="dvt_RowCount" select="$dvt_RowCount" />

<xsl:with-param name="RealLastRow" select="number(ddwrt:NameChanged('',-100))" />

</xsl:call-template>

</xsl:template>

<xsl:template name="dvt_1.body">

<xsl:param name="Rows" />

<xsl:param name="FirstRow" />

<xsl:param name="LastRow" />

<xsl:for-each select="$Rows">

<xsl:variable name="dvt_KeepItemsTogether" select="false()" />

<xsl:variable name="dvt_HideGroupDetail" select="false()" />

<xsl:if test="(position() &gt;= $FirstRow and position() &lt;= $LastRow) or $dvt_KeepItemsTogether">

<xsl:if test="not($dvt_HideGroupDetail)" ddwrt:cf_ignore="1">

<xsl:call-template name="dvt_1.rowview" />

</xsl:if>

</xsl:if>

</xsl:for-each></xsl:template>

<xsl:template name="dvt_1.rowview">

<tr>

<xsl:if test="false()" ddwrt:test="position() mod 2 = 1">

<xsl:attribute name="class">ms-alternating</xsl:attribute>

</xsl:if>



<xsl:if test="$dvt_1_automode = '1'" ddwrt:cf_ignore="1">

<td class="ms-vb" width="1%" nowrap="nowrap">

<span ddwrt:amkeyfield="ID" ddwrt:amkeyvalue="ddwrt:EscapeDelims(string(@ID))" ddwrt:ammode="view" />

</td>

</xsl:if>





<td class="ms-vb" style="height: 17px">

<div class="grid-thumb">

<a target="_self" href="detail.aspx?videoID={@ID}">

<img src="{@AlternateThumbnailUrl}" alt="{@Title}" width="300"/>

<p><xsl:value-of select="@Title"/></p>

</a>

</div>

</td>



<!--    <td class="ms-vb">

<xsl:value-of select="@RatingCount" />

</td>  -->

</tr></xsl:template>

<xsl:template name="dvt_1.commandfooter">

<xsl:param name="FirstRow" />

<xsl:param name="LastRow" />

<xsl:param name="RowLimit" />

<xsl:param name="dvt_RowCount" />

<xsl:param name="RealLastRow" />

<table cellspacing="0" cellpadding="4" border="0" width="100%">

<tr>

<xsl:if test="$FirstRow &gt; 1 or $dvt_nextpagedata">

<xsl:call-template name="dvt_1.navigation">

<xsl:with-param name="FirstRow" select="$FirstRow" />

<xsl:with-param name="LastRow" select="$LastRow" />

<xsl:with-param name="RowLimit" select="$RowLimit" />

<xsl:with-param name="dvt_RowCount" select="$dvt_RowCount" />

<xsl:with-param name="RealLastRow" select="$RealLastRow" />

</xsl:call-template>

</xsl:if>

</tr>

</table>

</xsl:template>

<xsl:template name="dvt_1.navigation">

<xsl:param name="FirstRow" />

<xsl:param name="LastRow" />

<xsl:param name="RowLimit" />

<xsl:param name="dvt_RowCount" />

<xsl:param name="RealLastRow" />

<xsl:variable name="PrevRow">

<xsl:choose>

<xsl:when test="$FirstRow - $RowLimit &lt; 1">1</xsl:when>

<xsl:otherwise>

<xsl:value-of select="$FirstRow - $RowLimit" />

</xsl:otherwise>

</xsl:choose>

</xsl:variable>

<xsl:variable name="LastRowValue">

<xsl:choose>

<xsl:when test="$LastRow &gt; $RealLastRow">

<xsl:value-of select="$LastRow"></xsl:value-of>

</xsl:when>

<xsl:otherwise>

<xsl:value-of select="$RealLastRow"></xsl:value-of>

</xsl:otherwise>

</xsl:choose>

</xsl:variable>

<xsl:variable name="NextRow">

<xsl:value-of select="$LastRowValue + 1"></xsl:value-of>

</xsl:variable>



</xsl:template>

</xsl:stylesheet></Xsl>

<DataSources>

<SharePoint:SPDataSource runat="server" DataSourceMode="List" SelectCommand="&lt;View&gt;&lt;Query&gt;&lt;OrderBy&gt;&lt;FieldRef Name=&quot;RatingCount&quot; Ascending=&quot;FALSE&quot;/&gt;&lt;/OrderBy&gt;&lt;Where&gt;&lt;And&gt;&lt;Leq&gt;&lt;FieldRef Name=&quot;VideoStartDate&quot;/&gt;&lt;Value Type=&quot;DateTime&quot;&gt;&lt;Today/&gt;&lt;/Value&gt;&lt;/Leq&gt;&lt;Or Group=&quot;true&quot;&gt;&lt;Geq&gt;&lt;FieldRef Name=&quot;VideoEndDate&quot;/&gt;&lt;Value Type=&quot;DateTime&quot;&gt;&lt;Today/&gt;&lt;/Value&gt;&lt;/Geq&gt;&lt;IsNull&gt;&lt;FieldRef Name=&quot;VideoEndDate&quot;/&gt;&lt;/IsNull&gt;&lt;/Or&gt;&lt;/And&gt;&lt;/Where&gt;&lt;/Query&gt;&lt;/View&gt;" UpdateCommand="" InsertCommand="" DeleteCommand="" UseInternalName="True" UseServerDataFormat="True" ID="dataformwebpart9"><SelectParameters><WebPartPages:DataFormParameter ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="{2CBF2D40-F565-4EFB-8B30-172952842953}" Name="ListID"></WebPartPages:DataFormParameter><asp:Parameter DefaultValue="0" Name="StartRowIndex"></asp:Parameter><asp:Parameter DefaultValue="0" Name="nextpagedata"></asp:Parameter><asp:Parameter DefaultValue="6" Name="MaximumRows"></asp:Parameter>

</SelectParameters><UpdateParameters><WebPartPages:DataFormParameter ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="{2CBF2D40-F565-4EFB-8B30-172952842953}" Name="ListID"></WebPartPages:DataFormParameter>

</UpdateParameters><InsertParameters><WebPartPages:DataFormParameter ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="{2CBF2D40-F565-4EFB-8B30-172952842953}" Name="ListID"></WebPartPages:DataFormParameter>

</InsertParameters><DeleteParameters><WebPartPages:DataFormParameter ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="{2CBF2D40-F565-4EFB-8B30-172952842953}" Name="ListID"></WebPartPages:DataFormParameter>

</DeleteParameters>

</SharePoint:SPDataSource>

</DataSources>

</WebPartPages:DataFormWebPart>

我在垂直视图中在SharePoint 2010中创建了数据视图webpart。我想修改并使其水平。

当前观点:

Image for Current View

我想要这样的东西。

结果视图:

Image for Result View

请知道吗?

感谢。

0 个答案:

没有答案