Wednesday, August 24, 2011

sharepont 2010:Display thumbnail view of picture library using ListViewWebPart/XsltListViewWebPart

here is the post with out customization i mean with out writing any code




first create a application page and copy below code.


.CS file
====================================================================

SPList oWorkingDocumentsList = oHomeWeb.Lists["Picture Gallery"];
            SPView oCustomView = oWorkingDocumentsList.Views["All Pictures"];
            XsltListViewWebPart xsltWP = new XsltListViewWebPart();
            xsltWP.ID = "xsltView";
            xsltWP.ListName = oWorkingDocumentsList.ID.ToString("B").ToUpper();
            xsltWP.ListId = oWorkingDocumentsList.ID;
            xsltWP.ViewGuid = oCustomView.Views[0].ID.ToString("B").ToUpper();

dvSummaryView.Controls.Add(xsltWP); //create a div control in aspx page and add it to div control

.aspx page
==================================================
<asp:Content ID="Content1" ContentPlaceHolderId="PlaceHolderLeftActions" runat="server">
<TABLE style="padding-top: 8px" cellSpacing=0 cellPadding=0 border=0 width=100%>
<TR valign=top><TD>&nbsp;</TD></TR>
</TABLE>
<TABLE id=ImgPreviewTable cellSpacing=2 cellPadding=0 border=0 width=100% style="display:none">
<TR><TD vAlign=center >
<SharePoint:EncodedLiteral ID="EncodedLiteral1" runat="server" text="<%$Resources:wss,piclib_picturePreview%>" EncodeMethod='HtmlEncode'/></TD></TR>
<TR><TD class="ms-navline" width=128><IMG SRC="/_layouts/images/blank.gif" width=1 height=1 alt=""></TD></TR>
<TR>
<TD vAlign=center align=center style="padding-top:3px" onClick="ClickPreview(); return false;">
<a name="lnkPreviewImg" id="lnkPreviewImg" href="Javascript:">
<img SRC="/_layouts/images/preview.jpg" NAME=ImgPreviewThumbnail ID=ImgPreviewThumbnail class=thumbnail height=90 width=120 alt="<SharePoint:EncodedLiteral runat='server' text='<%$Resources:wss,piclib_picturePreview%>' EncodeMethod='HtmlEncode' __designer:Preview="Picture Preview"/>"></a><br>
<a name="lnkPreviewTitle" id="lnkPreviewTitle" href="Javascript:" class="ms-imglibPreviewTitle">"<SharePoint:EncodedLiteral ID="EncodedLiteral2" runat='server' text='<%$Resources:wss,piclib_pictureFileName%>' EncodeMethod='HtmlEncode'/>"</a>
</TD>
</TR>
</TABLE>
</asp:Content>

No comments:

Post a Comment

Followers

Blog Archive