But this method is easy than the web service data retiring method following code is illustrate how to retrieve data form SharePoint list
SPSite site = new SPSite(SPContext.Current.Web.Url); SPWeb web = site.OpenWeb(); string ID = "7E49165B-9216-4c86-85F8-44732646EF06" SPList Events = web.Lists["Events"]; SPQuery query = new SPQuery(); query.Query = ""; SPListItemCollection EventItems = Events.GetItems(query); SPListItem CurrentItem = EventItems[0]; // assigning retirveing value DateTime EventDateValue = (DateTime)CurrentItem["Event Date and Time"]; Label lblTitle = new Label(); lblTitle.Text = CurrentItem["Event Title"].ToString(); lbldate.Text = EventDateValue.ToString("dd MMMM yyyy, hh.mm tt"); lblDes.Text = CurrentItem["Event Mini Description"].ToString(); PnlTitle.Controls.Add(lblTitle); " + ID + "
0 comments:
Post a Comment