I would very much appreciate any ideas on how to show a list of PageFiles for each page in a PageList.
You could add a ItemDataBound event and then check the pagefiles for each item and list them if you so wish.
Tried to download the source code for the original project for your link, but it seems that this was removed.
Being av newbie I found this a bit over my head and solved the problem in a less elegant way...
The good old <%#GetListOfFiles(Container.CurrentPage)%> ?
This would be very nice and simple, but GetListOfFiles does not exist inside the ItemTemplate of the PageList - At least not here...
My previous answer really place me as an EPiServer developer...
At first glance, I thought that you came up with an EPiServer solution to a known problem...
But I think that you are implying that I need to write my own method (GetListOfFiles).
If I should do this, I would like to display the files in a list with the filename as a hyperlink, the time it was uploaded, and the name of the user that uploaded. How would you solve this as opposed to write a method that returns a string to be diplayed inside a lebel control?
You are correct. I meant that you had to make the method yourself, or use this as a base:
public string GetListOfPageFiles(PageData page)
string result = "";
var dir = page.GetPageDirectory(false);
if (dir != null)
foreach (var fil in dir.GetFiles())
string name = fil.Name;
if (fil.Summary != null && !string.IsNullOrEmpty(fil.Summary.Title))
name = fil.Summary.Title;
result += "<li><a href=\"" + fil.VirtualPath + "\">" + name + "</a></li>";
if (result != "")
result= "<ul>" + result + "</ul>";
The fil.Summary attributes gives you some data about the fil, and the fil object have some others
That's great Anders.
I have been working with EPiServer/asp.net for 6 months now with no prior experience what so ever with c#/Visual Studio (I've worked with Delphi the last 10 years).
What I find the most frustrating with asp.net is that there are sooo many ways to solve a given task....
Thanks for the help - this will solve the task, and I will probably understand the code some time in the future.