0

I created a webpart. The webpart is a slider. I add new item on the webpart's list.

I want to I add my final list of items in that it appears at the top. So get the slider of the first image. How can I do this?

My webpart code:

<WebPartPages:XsltListViewWebPart runat="server" ViewFlag="" ViewSelectorFetchAsync="False" InplaceSearchEnabled="False" ServerRender="False" ClientRender="False" InitialAsyncDataFetch="False" WebId="00000000-0000-0000-0000-000000000000" IsClientRender="False" GhostedXslLink="main.xsl" ViewGuid="{1267E2D3-4EB4-4AFA-A14F-9D2521574A4E}" EnableOriginalValue="False" ViewContentTypeId="" ListName="{9154D3E4-9E00-4C0A-A4D9-EB4DBF6C3CC6}" ListId="9154d3e4-9e00-4c0a-a4d9-eb4dbf6c3cc6" PageSize="-1" UseSQLDataSourcePaging="True" DataSourceID="" ShowWithSampleData="False" AsyncRefresh="False" ManualRefresh="False" AutoRefresh="False" AutoRefreshInterval="60" Title="Duyuru" FrameType="None" SuppressWebPartChrome="False" Description="" IsIncluded="True" ZoneID="wpz" PartOrder="1" FrameState="Normal" AllowRemove="True" AllowZoneChange="True" AllowMinimize="True" AllowConnect="True" AllowEdit="True" AllowHide="True" IsVisible="True" CatalogIconImageUrl="/_layouts/15/images/itgen.png?rev=23" TitleUrl="/Lists/Duyuru" DetailLink="/Lists/Duyuru" HelpLink="" HelpMode="Modeless" Dir="Default" PartImageSmall="" MissingAssembly="Cannot import this Web Part." PartImageLarge="/_layouts/15/images/itgen.png?rev=23" IsIncludedFilter="" ExportControlledProperties="False" ConnectionID="00000000-0000-0000-0000-000000000000" ID="g_a6ca49f2_9eb5_4859_b170_4fe610578367" ChromeType="None" ExportMode="NonSensitiveData" __MarkupType="vsattributemarkup" __WebPartId="{1267E2D3-4EB4-4AFA-A14F-9D2521574A4E}" __AllowXSLTEditing="true" __designer:CustomXsl="fldtypes_Ratings.xsl" WebPart="true" Height="" Width=""><ParameterBindings>







<ParameterBinding Name="dvt_sortdir" Location="Postback;Connection" /><ParameterBinding Name="dvt_sortfield" Location="Postback;Connection" /><ParameterBinding Name="dvt_startposition" Location="Postback" DefaultValue="" /><ParameterBinding Name="dvt_firstrow" Location="Postback;Connection" /><ParameterBinding Name="OpenMenuKeyAccessible" Location="Resource(wss,OpenMenuKeyAccessible)" /><ParameterBinding Name="open_menu" Location="Resource(wss,open_menu)" /><ParameterBinding Name="select_deselect_all" Location="Resource(wss,select_deselect_all)" /><ParameterBinding Name="idPresEnabled" Location="Resource(wss,idPresEnabled)" /><ParameterBinding Name="NoAnnouncements" Location="Resource(wss,noXinviewofY_LIST)" /><ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(wss,noXinviewofY_DEFAULT)" /></ParameterBindings>
<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='yes'/>

    <xsl:template match='dsQueryResponse' xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" ddwrt:ghost="" xmlns:ddwrt2="urn:frontpage:internal" 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">
    <div class="container">
<div class="row">

        <div id="carousel-example-generic" class="carousel slide  bt-nav-mar" data-ride="carousel"> 

        <div class="carousel-inner">          
            <xsl:apply-templates select='Rows/Row'/>

        </div>
            <a class="left carousel-control" href="#carousel-example-generic" data-slide="prev"> 
            <span class="glyphicon glyphicon-chevron-left"></span> 
            </a> 
            <a class="right carousel-control" href="#carousel-example-generic" data-slide="next"> 
            <span class="glyphicon glyphicon-chevron-right"></span> 
            </a>    

    </div> 
    </div> 
    </div>
</xsl:template>

    <xsl:template match='Row'>
         <div class="item" id="xslide"> 
         <a href="/Lists/Duyuru/DispForm.aspx?ID={string(@ID)}"  class="fontText">

            <img><xsl:attribute name="src">
            <xsl:value-of select="@Resim"></xsl:value-of>
            </xsl:attribute></img>
            </a>
         </div>

     </xsl:template>

</xsl:stylesheet>

</Xsl>
<DataFields>
</DataFields>
<XmlDefinition>
<View Name="{1267E2D3-4EB4-4AFA-A14F-9D2521574A4E}" MobileView="TRUE" Type="HTML" Hidden="TRUE" DisplayName="" Url="/SitePages/Home.aspx" Level="1" BaseViewID="1" ContentTypeID="0x" ImageUrl="/_layouts/15/images/generic.png?rev=23" ><Query><OrderBy><FieldRef Name="ID"/></OrderBy></Query><ViewFields><FieldRef Name="LinkTitle"/><FieldRef Name="Resim"/></ViewFields><RowLimit Paged="TRUE">30</RowLimit><JSLink>clienttemplates.js</JSLink><XslLink Default="TRUE">main.xsl</XslLink><Toolbar Type="Standard"/></View></XmlDefinition>
</WebPartPages:XsltListViewWebPart>
4
  • Is this a custom webpart? While displaying items can't you use modified desc order by clause? – Amal Hashim Dec 22 '14 at 13:29
  • How can I add the clause? Is it In the list settings? @Amal – zengel Dec 22 '14 at 13:45
  • If its CAML query then you can use ORDER BY Ascending = False – Amal Hashim Dec 22 '14 at 13:47
  • @Amal I updated my questions. I added my xsl code. Should I add order by clause in the code? – zengel Dec 22 '14 at 13:51
2

Based on your updated question. You can change the following

<Query><OrderBy><FieldRef Name="ID"/></OrderBy></Query>

To

<Query><OrderBy><FieldRef Name="Modified" Ascending = "False"/></OrderBy></Query>
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.