How to add list and document views to visual web part

I am trying develop an custom user control in video studio. I need to

  •     Display columns from the CASE list.
  •     Display items that related to above case from the PEASON list.
  •     Display all documents that related to the above case from the CASEDOC document library.

My question is how to display SharePoint list and document library views in the user control (custom web part).

Many thanks for your advice.

May 15th, 2015 2:12pm

Hello,

you can display all the list and libraries present in your site using server object model code mentioned below.

SPWeb mySite = SPContext.Current.Web;

SPListCollection myListCollection = mySite.Lists;

foreach (SPList myList in myListCollection)

{

Label1.Text += myList.Title + "";

}

Free Windows Admin Tool Kit Click here and download it now
May 16th, 2015 12:40pm

Hi,

From your description, my understanding is that you want to add list and document views to visual web part.

If my understanding is correctly, you could accomplish your requirement with SharePoint:SPGridView control. This article below is about SharePoint:SPGridView, you could custom the grid view as the list and document view, then bind related data from list and document to the grid view:

http://sharepoint.stackexchange.com/questions/87875/how-to-display-list-on-application-aspx-page-by-visual-studio

Best Regards,

Vincent Han

May 18th, 2015 5:47am

Thanks for your response. However, I need to be able to open the person items or documents so label will not work for me.
Free Windows Admin Tool Kit Click here and download it now
May 18th, 2015 9:27am

Thanks, I will give a try. I wish the SPGridView will give me the ability to open the person and document items.
May 18th, 2015 9:28am

Hi Vincent,

I have an issue with the sample that AutoGenerateColumns cannot set to "true"? if this is the case, I need to manually create the columns. Do you have a sample of create column and the "link item" column? Thanks.

Free Windows Admin Tool Kit Click here and download it now
May 18th, 2015 1:28pm

Hi,

You could learn how to create a SPGridView by referring these articles below:

http://www.codeproject.com/Articles/35536/Creation-of-a-SPGridview-Webpart-having-Pagination

https://code.msdn.microsoft.com/office/Ejemplos-sobre-cmo-usar-el-69cd5f16

If you want to link to these items in the SPGridView, you could get the links of items, and bind them to the SPGridView.

Best Regards,

Vincent Han

May 18th, 2015 9:27pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics