开发者

SharePoint List Control in a custom WebPart and C#

开发者 https://www.devze.com 2023-02-04 08:56 出处:网络
All, I am trying to replace a DataGrid that I have with the SPList control in Visual Studio 2010 C#, but where does th开发者_开发技巧is control live, and how can I use it?

All,

I am trying to replace a DataGrid that I have with the SPList control in Visual Studio 2010 C#, but where does th开发者_开发技巧is control live, and how can I use it?

Are there examples?

Bill.


There is no SPList Control, SPList is a class.

What you are talking about is ListViewWebPart , a web Part which is used to display lists. This is used by SharePoint.

You can use this dynamically as described here:
http://weblogs.asp.net/jan/archive/2005/06/22/414283.aspx


Maybe you mean the SPGridView control. There's an example for SharePoint 2007 here: http://blogs.msdn.com/b/powlo/archive/2007/02/25/displaying-custom-data-through-sharepoint-lists-using-spgridview-and-spmenufield.aspx

I haven't used it in SP2010 yet, but I suppose it's still there and works more or less the same.


There's a whole bunch of options:

  • Use sharepoint designer to "design" your webpart (for data usually based on the DataFormWebPart or, in SP2010, the XsltListViewWebPart). When your done, export the .webpart file and import it into sharepoint.

  • In Visual Studio 2010, create a visual webpart, and use the standard ASP.NET ListView or GridView on it.

  • In Visual Studio, program a webpart and override the CreateChildControls method and add an SPGridView, ListViewWebPart, etc. etc. through code.

0

精彩评论

暂无评论...
验证码 换一张
取 消