SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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();

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!

share|improve this question
up vote 0 down vote accepted

If I understand your question correctly, I did this before using this example:

I hope that helps.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.