ListViewWebPart programmatically set the List/Path
-
06-12-2019 - |
Question
The ListView Webpart is a component created to show a list inside a page... It's very usefull and easy to use... The way to create a ListViewWebPart and set a list is very simple:
myListView = new Microsoft.SharePoint.WebPartPages.ListViewWebPart();
myListView.Visible = true;
myListView.EnableViewState = true;
SPList list = oWebSite.Lists[listName];
myListView.ListName = list.ID.ToString("B").ToUpperInvariant();
myListView.TitleUrl = list.DefaultViewUrl;
myListView.WebId = list.ParentWeb.ID;
myListView.ListId = (System.Guid)list.ID;
myListView.ViewGuid = list.DefaultView.ID.ToString("B").ToUpperInvariant();
Controls.Add(myListView);
When i click on a folder inside the webpart it redirect me to an url like this:
In wich Sharepoint sets the folder to access... Is it possible to set that folder programmatically without using the RootFolder parameter? And a way to avoid the "reading" of the query string if i want to force the list to my orders?
Anybody knows a way? Thank you very much!
Solution
If I understand your question correctly, I did this before using this example:
http://www.sharepointconfig.com/2010/11/displaying-files-from-a-specific-folder-using-spdatasource/
I hope that helps.