November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
You could add a ItemDataBound event and then check the pagefiles for each item and list them if you so wish.
See: http://antecknat.se/blog/2008/12/19/episerverpagelist-with-itemdatabound/
Thanks Petter.
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...
Petter
Hi Anders.
This would be very nice and simple, but GetListOfFiles does not exist inside the ItemTemplate of the PageList - At least not here...
Any suggestions?
Petter
Hi Anders.
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?
Petter
Hi
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>";
return result;
}
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.
I would very much appreciate any ideas on how to show a list of PageFiles for each page in a PageList.
Br
Petter