protected void getLinks() { popularContainer.InnerHtml = ""; SPWeb thisWeb = SPContext.Current.Web; try { using (SPSite site = new SPSite(SPContext.Current.Web.Url)) { using (SPWeb web = site.OpenWeb()) { SPPictureLibrary lists = (SPPictureLibrary)web.Lists[_LibraryName.ToString()]; // for (int i = 0; i < lists.ItemCount; i++) { string image = lists.Items[i].Url; string link = Convert.ToString(lists.Items[i][_LinkField.ToString()]); string alt = Convert.ToString(lists.Items[i][_AltField.ToString()]); link = link.Split(',')[0]; addItem(image, link, alt); } } } } catch (Exception e) { Label lblError = new Label(); this.Controls.Add(lblError); if (e.InnerException != null) { lblError.Text = "An error has occured reading from the selected list. Please check the promotions properties." + e.InnerException.ToString(); } } }
protected void getList() { SPWeb thisWeb = SPContext.Current.Web; String url = HttpContext.Current.Request.Url.ToString(); if (url.Contains("SitePages")) { url = url.Split(new string[] { "SitePages" }, StringSplitOptions.None)[0]; } try { using (SPSite site = new SPSite(SPContext.Current.Web.Url)) { using (SPWeb web = site.OpenWeb()) { SPPictureLibrary lists = (SPPictureLibrary)web.Lists[_LibraryName.ToString()]; // for (int i = 0; i < lists.ItemCount; i++) { string pic = lists.Items[i].Url; string title = Convert.ToString(lists.Items[i][_TitleValue.ToString()]); string link = Convert.ToString(lists.Items[i][_LinkValue.ToString()]); string order = Convert.ToString(lists.Items[i][_OrderValue.ToString()]); string modDate = Convert.ToString(lists.Items[i]["Modified".ToString()]); link = link.Split(',')[0]; NaviItemList.Add(new NaviItem(pic, title, link, order)); } NaviItemList.Sort((a, b) => a.ToString().CompareTo(b.ToString())); foreach (NaviItem item in NaviItemList) { item.addLi(naviItems, url); } } } } catch (Exception e) { Label lblError = new Label(); this.Controls.Add(lblError); if (e.InnerException != null) { lblError.Text = "An error has occured reading from the selected list. Please check the Navi properties. " + e.InnerException.ToString(); } } }
protected void getList() { // PromoItemsContainer.InnerHtml = "<div id=\"owl-example\" class=\"owl-carousel promoBox\" style=\"width:580px\"><div runat=\"server\" ID=\"PromoItems\" >"; PromoItemsContainer.InnerHtml = "<div id=\"owl-example\" class=\"owl-carousel promoBox\" style=\"width:800px;\">"; SPWeb thisWeb = SPContext.Current.Web; try { using (SPSite site = new SPSite(SPContext.Current.Web.Url)) { using (SPWeb web = site.OpenWeb()) { SPPictureLibrary lists = (SPPictureLibrary)web.Lists[_LibraryName.ToString()]; // for (int i = 0; i < lists.ItemCount; i++) { string pic = lists.Items[i].Url; string title = Convert.ToString(lists.Items[i][_TitleValue.ToString()]); string desc = Convert.ToString(lists.Items[i][_DescValue.ToString()]); string link = Convert.ToString(lists.Items[i][_LinkValue.ToString()]); link = link.Split(',')[0]; addItemToPromo(title, desc, pic, link); } PromoItemsContainer.InnerHtml += "</div><script type=\"text/javascript\">$(document).ready(function() { $(\"#owl-example\").owlCarousel();});</script>"; } } } catch (Exception e) { Label lblError = new Label(); this.Controls.Add(lblError); if (e.InnerException != null) { lblError.Text = "An error has occured reading from the selected list. Please check the promotions properties." + e.InnerException.ToString(); } } }