+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Setting default text to display when Download list widget is empty

Setting default text to display when Download list widget is empty

4 posts, 0 answered
  1. John
    John avatar
    51 posts
    Registered:
    11 Apr 2013
    22 Nov 2013
    Link to this post
    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?
  2. Junior Dominguez
    Junior Dominguez avatar
    115 posts
    Registered:
    08 Dec 2016
    26 Nov 2013
    Link to this post
    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
  3. John
    John avatar
    51 posts
    Registered:
    11 Apr 2013
    26 Nov 2013 in reply to Junior Dominguez
    Link to this post
    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.
  4. Junior Dominguez
    Junior Dominguez avatar
    115 posts
    Registered:
    08 Dec 2016
    27 Nov 2013
    Link to this post
    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
4 posts, 0 answered