This question already has an answer here:

Since we upgraded to WSS 3.0, I have an issue with the list webpart on the default.aspx page.

If I go to Edit page, add web part - list or library, the view used on the default.aspx is incorrect. It is missing the column 'modified' that shows the date. When I click on the web part header to proceed to the AllItems.aspx page, the view is correct.

I've created a new view, set is as the default view, but this only applies on the AllItems.aspx pages. When adding the webpart to the default.aspx page, the view is not used. The webpart is always in 'current view'. Changing this to the newly created view then makes it show all columns specified in the view I created.

Does anyone know what view is used when the webpart is first added to the page default.aspx? Or, to ask another way, which view is the webparts 'current view' based on?

I can change the view manually each time I add a webpart, but I'd like it to reflect the correct view at the time of adding it to the page.

Kind regards, Geert

marked as duplicate by Benny Skogberg Feb 7 '14 at 11:37

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


already answered here:

Which view is the "Current view"?

That is not updated when you change the view on the list itself. You have to update the view on the web part.

Current View is simply the current view of the list web part. It is the default name given to the view that is used when the list web part is added to the page. Editing / Modifying the view on the web part will not affect the views on the list itself.

If you create a custom view on the list, you can select that as the basis for the web part view, but again changes to the view on the list itself will not be reflected on the web part or vice versa.

Just to clarify what is going on here:

dont get confused with current view thinking its the current view of the list or library that is set as default! no its the current view that is the default sharepoint view that is stored on the webpart! so if you were to change the view of the webpart it would store it on the webpart as a "new" view relative to the webpart and not to the actual list!

do you get where im comming from? unfortunatly its not dynamic in the sense that if you select current view in the webpart it would change if you were to change the default view of the list or library!....

solution? do it through code! add the listviewwebpart to a webpart somthing on the lines of:

        using (SPSite site = new SPSite(SPContext.Current.Site.Url))
            using (SPWeb web = site.OpenWeb("mysubsite"))

                SPList oList = web.Lists["mylist"];
                oListViewWP.ListName = oList.ID.ToString("B").ToUpper();

                oListViewWP.ViewGuid = oList.DefaultView.ID.ToString("B").ToUpper();
                oListViewWP.WebId = web.ID;

or change the sharepoint list default view which i think is all documents or all items! when going into site action -> site settings -> site library and lists -> select the list -> scroll to the bottom -> under views you can see the default view when you first create the list -> its that view its using! click on the view and change that! then add the webpart to the page and it should pick up the new view.

otherwise create the webpart through code it will look at the list for its default set view that you would change and it would update accordingly every time it creates the page so there is no need to change the sharepoint default view!!

  • 1
    Yes, I understand that. The current view is created at the time off adding the List Web Part to default.aspx. I can then change that view to a custom view, or edit the "current view". But what is the 'current view' based on when I add it to the default.aspx page, as it does not reflect any layout of the list views available? In other words, how can I adapt the 'current view' the List web part defaults to when adding it to default.aspx, without having to manually change the view for each web part added? – gvereeck Feb 7 '14 at 11:11
  • just ammended the answer! – Ali Jafer Feb 7 '14 at 11:25

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