Document List File Naming Issue
The Download List displays exactly what the file name is in your library document folder.
I want the webpage link to say "View Manual" but I still want to keep the pdf file name to say...Charbroiler XYZ.
I had to change the names of all the files to get the webpage to say View Manual and that is not right for file management in the back end.
There must be a better way to handle this.
Hi Tony,
You can change the link's title to display "View Manual" or any other text programmatically. Please note that this will not change the document's title. If you are using the "List" option to display your Download list of items you can create a .cs file inheriting the MasterListView class and use the following code sample:
public
class
CustomMasterListView : MasterListView
public
override
void
DataBindDocumentList()
if
(
base
.Query !=
null
||
this
.DataSource !=
null
)
if
(
this
.TotalCount == 0)
this
.ItemsContainer.Visible =
false
;
this
.DocumentsRepeater.Visible =
false
;
else
this
.DocumentsRepeater.ItemDataBound +=
new
RepeaterItemEventHandler(DocumentsRepeater_ItemDataBound1);
if
(
this
.DataSource ==
null
)
this
.DocumentsRepeater.DataSource =
base
.Query.ToList();
else
this
.DocumentsRepeater.DataSource =
this
.DataSource;
this
.DocumentsRepeater.DataBind();
if
(
this
.ItemsContainer !=
null
)
if
(
base
.ThumbnailType == ThumbnailType.SmallIcons)
this
.ItemsContainer.Attributes[
"class"
] +=
" sfSmallIcns"
;
else
if
(
base
.ThumbnailType == ThumbnailType.BigIcons)
this
.ItemsContainer.Attributes[
"class"
] +=
" sfLargeIcns"
;
void
DocumentsRepeater_ItemDataBound1(
object
sender, RepeaterItemEventArgs e)
if
((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
var dataItem = e.Item.DataItem;
var document = (Document)dataItem;
if
(document !=
null
)
var ext = document.Extension;
if
(ext.Length > 0)
ext = ext.Remove(0, 1);
var documentLink = e.Item.FindControl(
"documentLink"
)
as
HyperLink;
if
(documentLink !=
null
)
documentLink.Text =
"View Manual"
;
// you can put your required title here ...
documentLink.ToolTip = document.Description;
documentLink.NavigateUrl = document.MediaUrl;
var documentInfoLabel = e.Item.FindControl(
"infoLabel"
)
as
SitefinityLabel;
if
(documentInfoLabel !=
null
)
documentInfoLabel.Text =
string
.Format(
"0, 1"
, ext.ToUpperInvariant(),
base
.ConfigureBytes(document.TotalSize));
var rowitem = e.Item.FindControl(
"docItem"
)
as
HtmlGenericControl;
if
(rowitem !=
null
)
rowitem.Attributes[
"class"
] +=
" sf"
+ ext.ToLower();
Dear Tony
What happens if you got to Content - Documents & Files and then click on your document. Then change the title and the URL to your needs.
Could this help you to get close to what you want. You could even add an extra URL.
Markus
Markus,
By George...I think that is the answer!!!
So, let me ask you this question with this solution in mind.
If I have a PDF named 123456789.pdf and I upload that to my Documents sub folders. I then click on that file name and edit the title properties to say something more useful like View Manual. Then I go down to the Advanced tab and change the URL to say Cold-Well-Steam-Tables and have the multiple URLs check box checked.
Then when I Publish this PDF and go to the page and look at my Document List for that product, I see the View Manual text and it has a rollover link of Cold-Well-Steam-Tables.pdf and not 123456789.pdf.
This should work, right?
Thanks again for your help!!!
Dear Tony
www.marktold.com/screencast/sf_tony.swf show you how it works.
The URL shown in the downlaod widget will be the one you give in the document section. Most probably the original url of your document. I thought thats what you wanted. The additional URL let you access the file directly with another url. I guess thats mostly for linking in mails for example.
go to www.mydomain.com/manual instead of the other urls 1234569789 and so on. So I would say just give it a try.
Sitefinity does a lot of stuff out of the box. And is simply the best CMS on the market :-)
Markus
Hello Markus,
Thank you for sharing the solution with the community.
Regards,
Sabrie Nedzhip
Telerik
Dear Sabrie
If you are so much on the receiving side as me, it feels good if I might help someone else for once :-)
Hope this workaround suites Tony.
Markus
Yes Markus, that is the solution.
Thank you for helping me out and the forum too.
Markus, can you look at this forum question and see what you might think of:
www.sitefinity.com/.../download-list-questions