Setting default text to display when Download list widget is

Posted by Community Admin on 03-Aug-2018 16:57

Setting default text to display when Download list widget is empty

All Replies

Posted by Community Admin on 22-Nov-2013 00:00

I have a Download list widget installed that contains files that are published by date. When those files are automatically unpublished and  none are left to display I want to put up a default message. Is this possible out of the box?

Posted by Community Admin on 26-Nov-2013 00:00

Hello John,
Thank you for coming to us,
To make it possible, you may create a class that inherits from MasterListView as shown in the following code sample:

using System;
 using System.Web.UI.WebControls;
 using Telerik.Sitefinity.Modules.Libraries.Web.UI.Documents;
 
 public class MyCustomDownloadList : MasterListView
 
  public string EmptyLinkText
         
             get return "Some text";
         
 
        protected override void OnPreRender(EventArgs e)
         
             base.OnPreRender(e);
             if (this.IsEmpty)
             
                 var emptyMessageLiteral = new Literal();
                 emptyMessageLiteral.Text = this.EmptyLinkText;
                 this.Container.Controls.Add(emptyMessageLiteral);
             
         
 
        public bool IsEmpty
         
             get
             
                 if (this.TotalCount == 0)
                 
                     return true;
                 
                 return false;
             
         
 


After that, you will need to go to Administration->Settings->Advanced->Libraries->Controls->FrontendDocuments->Views->MasterListView as shown in the following image:




Then locate the property ViewType by the bottom of the page and replace the content with the name of your control, including the namespace, for example: 

SitefinityWebApp.MyControls.CustomDownloadList.MyCustomDownloadList






Save the changes and that's it.

Thank you again and please, do not hesitate in get back to us if you need any further assistance.

Best Regards,

Junior Dominguez
Telerik
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 26-Nov-2013 00:00

I went  thru that process & made the changes and saved my changes. I then went back to check the settings and the viewtype was changed back to the default class and namespace.

Posted by Community Admin on 27-Nov-2013 00:00

Hi John,

Thank you for getting back to us,
Usually, any modification to the Settings in Sitefinity, requires the application to restart.
Try to rebuild the application in Visual Studio and refresh the Sitefinity website in the browser.
If the problem persists can you, please, send us a short video showing the issue, for us to get a better idea about what is happening?

Best Regards,
Junior Dominguez
Telerik

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