none
Thumbnail view of Asset library in Custom web part in Visual Studio 2010

    Question

  • I am developing a custom list view web part in share point 2010 , I am using DefaultViewUrl property. I am getting all asset view.

    how to change it to  thumbnail view?

    SPWeb oWebSite = SPContext.Current.Web;
                    ListViewWebPart myListView = new Microsoft.SharePoint.WebPartPages.ListViewWebPart();
                    myListView.Visible = true;
                    myListView.EnableViewState = true;
                    SPList list = oWebSite.Lists["Corporate"];

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

                    myListView.HelpMode = WebPartHelpMode.Modeless;

                    Controls.Add(myListView);

    Wednesday, September 19, 2012 7:15 PM

Answers

  • Hi Parija,

    The list view you see is a little different from the all asset view, you can set the thumbnail view as the list default view, and use myListView.ViewGuid = list.DefaultView.ID.ToString("B").ToUpperInvariant(); to have a check. When you generate the view in your custom list view web part, it is the by default scenario of thumbnail view.<//span>

    In this situation, I have a workaround for you. Go to the Asset Library, create a Standard View, named like “ThumbnailTest”, then choose “Thumbnail Preview” and “Name(link to document)” columns, save the view, then set the list view to “ThumbnailTest” in your custom list view web part.

    Thanks,

    Friday, September 21, 2012 2:20 AM
    Moderator
  • Hi Parija,

    Do you mean that you have create a standard view, choose the “Thumbnail Preview” and “Name(link to document) ” columns as I posted in my last reply? Please try this as a workaround as using the thumbnail view in a custom list view web part doesn’t show same result as it is the library.

    Thanks,


    Qiao Wei

    TechNet Community Support

    Friday, September 28, 2012 3:07 AM
    Moderator

All replies

  • Hi Parija,

    From your description, I understand that you want to create a list view web part using Thumbnail View of asset library, if so, you can set the ViewGuid of the list view web part to the Thumbnail View of the list.

    SPView _view = list.Views["Thumbnails"];

    myListView.ViewGuid = _view.ID.ToString("B").ToUpperInvariant();

    When using the Thumbnail view in the web part, the list view you can see seems different from the default thumbnail view in the list. You can also see this difference when opening the list view in SharePoint Designer, you can see the same web part view in designer and the custom list view in Visual Studio. It seems that the thumbnail view you can see in the list is by design in the list view, to make it shows as the specific format.

    Thanks,


    Qiao Wei

    TechNet Community Support

    Thursday, September 20, 2012 9:36 AM
    Moderator
  • Thanks for your answer. But on browser it is still showing all asset view instead of Thumbnail view.
    Thursday, September 20, 2012 2:41 PM
  • Hi Parija,

    The list view you see is a little different from the all asset view, you can set the thumbnail view as the list default view, and use myListView.ViewGuid = list.DefaultView.ID.ToString("B").ToUpperInvariant(); to have a check. When you generate the view in your custom list view web part, it is the by default scenario of thumbnail view.<//span>

    In this situation, I have a workaround for you. Go to the Asset Library, create a Standard View, named like “ThumbnailTest”, then choose “Thumbnail Preview” and “Name(link to document)” columns, save the view, then set the list view to “ThumbnailTest” in your custom list view web part.

    Thanks,

    Friday, September 21, 2012 2:20 AM
    Moderator
  • I am going to give it a try.
    Friday, September 21, 2012 12:41 PM
  • It is displaying same view using this as well. As here also we are passing ID.
    Monday, September 24, 2012 3:39 PM
  • Hi Parija,

    Do you mean that you have create a standard view, choose the “Thumbnail Preview” and “Name(link to document) ” columns as I posted in my last reply? Please try this as a workaround as using the thumbnail view in a custom list view web part doesn’t show same result as it is the library.

    Thanks,


    Qiao Wei

    TechNet Community Support

    Friday, September 28, 2012 3:07 AM
    Moderator