Tell me more ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a webpart which contains 2 ListView Web Part: one of them has a view that shows folder, the other one the docs.

The code I've written is this:

    private Microsoft.SharePoint.WebPartPages.ListViewWebPart Pratiche;
    private Microsoft.SharePoint.WebPartPages.ListViewWebPart Documenti;

    protected override void CreateChildControls()
    {
        base.CreateChildControls();
        SPSite oSiteCollection = SPContext.Current.Site;
        SPWeb oWebSite = SPContext.Current.Web;

        string codiceCliente = Request.Params["CodiceCliente"];

        if (String.IsNullOrEmpty(codiceCliente))
        {
            if (ViewState["CodiceCliente"] == null) return;
            else codiceCliente = ViewState["CodiceCliente"].ToString() ;
        }

        ViewState["CodiceCliente"] = codiceCliente;

        //PRATICHE
        string listName = codiceCliente;
        SPList list = oWebSite.Lists.TryGetList(listName);

        if (list != null)
        {
            Pratiche = new Microsoft.SharePoint.WebPartPages.ListViewWebPart();
            Pratiche.Visible = true;
            Pratiche.EnableViewState = true;
            Pratiche.ListName = list.ID.ToString("B").ToUpperInvariant();
            Pratiche.TitleUrl = list.DefaultViewUrl;
            Pratiche.WebId = list.ParentWeb.ID;

            Pratiche.ListId = (System.Guid)list.ID;

            Pratiche.ViewGuid = list.Views["Pratiche"].ID.ToString("B").ToUpperInvariant();

            Pratiche.HelpMode = WebPartHelpMode.Modeless;
        }

        Controls.Add(Pratiche);

        //DOCUMENTI

        if (list != null)
        {
            Documenti = new Microsoft.SharePoint.WebPartPages.ListViewWebPart();
            Documenti.Visible = true;
            Documenti.EnableViewState = true;
            Documenti.ListName = list.ID.ToString("B").ToUpperInvariant();
            Documenti.TitleUrl = list.DefaultViewUrl;
            Documenti.WebId = list.ParentWeb.ID;


            Documenti.ListId = (System.Guid)list.ID;
            Documenti.ViewGuid = list.Views["DocsOnly"].ID.ToString("B").ToUpperInvariant();

            Documenti.HelpMode = WebPartHelpMode.Modeless;
        }

        Controls.Add(Documenti);

    } 

This works great: shows me in one listview the folders and in another one the documents... The problems is when i click on a folder: one webppart enters the folder but the other one no..

How can I do to solve this problem?

Thank you very much!

EDIT:

If I Use the same "View" for the listViewWebPart everything goes fine so I suppose is a "View" Parameter problem.. How can I remove it? Or just not consider it!

share|improve this question

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.