protected override void CreateChildControls()
{if(!_error)
{
try
{
base.CreateChildControls();
//EnterpriseAnnouncement webpart
SPWeb web = SPContext.Current.Web;
SPList enterpriseNoticeList = web.Lists[“EnterpriseNoticeBoardUrlName”];
SPQuery query = new SPQuery();
SPListItemCollection collection = enterpriseNoticeList.GetItems(query);
if(collection != null)
{SummaryLinkWebPart announcementWP = new SummaryLinkWebPart();
announcementWP.Title = ConfigurationInfo.AnnouncementsListDisplayName;
int counter = 0;
foreach (SPListItem item in collection)
{try
{
announcementWP.SummaryLinkValue.SummaryLinks.Add
(new SummaryLink(item["Title"].ToString()));
announcementWP.SummaryLinkValue.SummaryLinks[counter].LinkUrl = http://www.google.lk;
//EnterpriseAnnouncement
item[“URL”].ToString();
announcementWP.SummaryLinkValue = announcementWP.SummaryLinkValue;
counter++;
}
catch(Exception ex)
{}
}
this.Controls.Add(announcementWP);
else
{} }
catch(Exception ex)
}
}
}
No comments:
Post a Comment