Custom Download List Widget Not Showing Document Images

Posted by Community Admin on 04-Aug-2018 16:40

Custom Download List Widget Not Showing Document Images

All Replies

Posted by Community Admin on 20-Mar-2013 00:00

I created a custom widget for the Download List with documents. My only issue is that the thumbnails aren't working...

I created this user control in my SitefinityWebApp using folder UserControls
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="AdministrativeDocumentsFormsList.ascx.cs" Inherits="SitefinityWebApp.UserControls.AdministrativeDocumentsFormsList" %>
<%@ Register TagPrefix="telerik" Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" %>
<%@ Register TagPrefix="sitefinity" Namespace="Telerik.Sitefinity.Web.UI" Assembly="Telerik.Sitefinity" %>
<%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI.PublicControls.BrowseAndEdit" Assembly="Telerik.Sitefinity" %>
<sitefinity:ResourceLinks id="resourcesLinks2" runat="server" Theme="Default">
<sitefinity:ResourceFile Name="Telerik.Sitefinity.Resources.Themes.Basic.Styles.icons.css" Static="true" />
</sitefinity:ResourceLinks>

<telerik:RadGrid id="documentsGrid" runat="server"
CssClass="sfdownloadTable sfTableMode"
skin="Sitefinity" AutoGenerateColumns="false" OnItemDataBound="documentsGrid_ItemDataBound">
<ClientSettings EnableRowHoverStyle="false" EnableAlternatingItems="false" />
<PagerStyle Mode="NumericPages" />
<MasterTableView PageSize="50" EnableNoRecordsTemplate="true">
<Columns>
<telerik:GridBoundColumn UniqueName="title" HeaderText="<%$ Resources:Labels, File %>" DataField="Title" ItemStyle-CssClass="sfdownloadTitle" HeaderStyle-CssClass="sfdownloadTitle" />
<telerik:GridBoundColumn UniqueName="description" HeaderText="<%$ Resources:Labels, Description %>" DataField="Description" ItemStyle-CssClass="sfdownloadDescription" HeaderStyle-CssClass="sfdownloadDescription" />
<telerik:GridTemplateColumn
UniqueName="templateColumn"
HeaderText="<%$ Resources:Labels, Download %>"
ItemStyle-CssClass="sfdownloadCell" HeaderStyle-CssClass="sfdownloadCell" >
<ItemTemplate>
<sitefinity:SitefinityHyperLink ID="documentLink" runat="server" Text="<%$ Resources:Labels, Download %>" CssClass="sfdownloadLink" target="_blank" />
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
<NoRecordsTemplate>No documents found!</NoRecordsTemplate>
</MasterTableView>
</telerik:RadGrid>

I am not sure if a reference is off (maybe to the icons css)... or if my itemdatabound logic is...but any help would be great...

in my code behind, this is in my itemdatabound. I assumed that "ThumbnailURL" would correspond to the hyperlink image url but when i view in page it is invalid.

SitefinityHyperLink link = dataItem["templateColumn"].FindControl("documentLink") as SitefinityHyperLink;

Document documentItem = (Document)e.Item.DataItem;

if (link != null)

link.ToolTip = documentItem.Description;
link.NavigateUrl = documentItem.MediaUrl;
link.ImageUrl = documentItem.ThumbnailUrl;
link.Text = documentItem.Title;


my data source is simply tied to the list from App.WorkWith()
.DocumentLibrary(parentLibrary.Id)
.Documents()
.Where(d => d.Status == ContentLifecycleStatus.Live)
.Get().ToList();

I attached a photo that shows the standard grid on top of the custom grid. obviously mine isn't working the greatest yet.

Thanks

Posted by Community Admin on 25-Mar-2013 00:00

Hello Dustin,

Thumbnails can be added to document items, but there is no authomatic code for generation when you upload an image to a document. This is why you couldn't access the thumbnailUrl  - simply documents don't have thumbnails by default (as you can see by yourself in the sf_media_thumbnails table of teh database) As a workaround, I would suggest you to either use Image Libraries or use teh MediaUrl property of the documents and set the height and width of the items with css. 

All the best,
Jen Peleva
the Telerik team
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 28-Mar-2013 00:00

I finally figured this out... in my css class for the radgrid i had to add css class "sfHasIcons" and in my code behind on my item databind i had to set the css class for each document type

dataItem["templateColumn"].CssClass = "sf" + document.Extension.Replace(".", "");

Posted by Community Admin on 01-Apr-2013 00:00

Hi Dustin,

Thank you for sharing your implementation with the community! 

Regards,
Jen Peleva
the Telerik team
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

This thread is closed