I'm trying to put a ListViewWebPart on an Application Page.
I want to start the displayed document library in a specific folder, say "Folder 1".
I tried the following (as shown here):
ListViewWebPart lvWebPart = new ListViewWebPart
{
ChromeType = PartChromeType.None
};
SPQuery query = new SPQuery { Folder = spWeb.GetFolder(folderPath) };
lvWebPart.ListName = list.ID.ToString("B").ToUpper();
SPView view = list.DefaultView;
view.Query = query.Query;
lvWebPart.ViewGuid = view.ID.ToString("B").ToUpper();
lvWebPart.ListViewXml = view.HtmlSchemaXml;
Controls.Add(lvWebpart);
The problem is that the listview always displays the list in the root folder. I just can't get to start the webpart in a sub folder. query.Query is null, but I still need to a assign a string value to view.Query - seems odd.
Could anyone tell me how I can start the WebPart in a specific folder? I also want to use the document librarie's upload button to upload to that folder then.
myfolderpathhere, but do I have to use a querystring? – moontear May 22 '12 at 19:43