Setting default text to display when Download list widget is empty
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?
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,
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.
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