Showing Library & List Items in Custom Grid View Web
part:
pulling the library & list items data from share point 2010 site and showing in custom grid view web-part
using visual studio 2010.
C# Code To display The
Library & List Items:
SPWeb objWeb;
SPSite objSpSite;
SPList oList;
objSpSite = SPContext.Current.Site;
objWeb =
objSpSite.OpenWeb();
oList =
objWeb.Lists["GBMListNew"];
SPView objView = oList.Views["All
Documents"];
SPListItemCollection collItem = oList.GetItems(objView);
DataTable dtSponsorships = collItem.GetDataTable();
gvGBMFormLib.DataSource
= dtSponsorships;
gvGBMFormLib.DataBind();
Client Side Code:
<asp:GridView ID="gvGBMFormLib" runat="server" Visible
="true" >
</asp:GridView>
No comments:
Post a Comment