protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); Visible = Controls.Count > 0; if (Visible) { Register.TabPanel(Page, "." + CssClass.Replace(' ', '.'), RegisterTabCss); } }
/// <summary> /// Effectue le rendu du contrôle /// </summary> /// <param name="writer"></param> protected override void Render(System.Web.UI.HtmlTextWriter writer) { if (_data == null) { return; } List <string> images = (from z in _data.catalog_articles_documents select z.doa_url_document).ToList(); if (!_prd.ecommerce_articles_web[0].Isarw_url_img_bigNull()) { images.Insert(0, _prd.ecommerce_articles_web[0].arw_url_img_big); } writer.Write("<amp-carousel layout='responsive' type='slides' "); if (Height.HasValue) { writer.Write(" height='"); writer.Write(Height.Value.ToString("0")); writer.Write("'"); } if (Width.HasValue) { writer.Write(" width='"); writer.Write(Width.Value.ToString("0")); writer.Write("'"); } if (!string.IsNullOrEmpty(CssClass)) { writer.Write(" class='"); writer.Write(CssClass.Replace("'", "-")); writer.Write("'"); } writer.WriteLine(">"); foreach (var i in images) { writer.Write("<amp-img src='"); writer.Write(i); if (Height.HasValue) { writer.Write("' height='"); writer.Write(Height.Value.ToString("0")); } if (Width.HasValue) { writer.Write("' width='"); writer.Write(Width.Value.ToString("0")); } writer.WriteLine("' layout='responsive'></amp-img>"); } writer.WriteLine("</amp-carousel>"); }
private void SetCssClasses(Asset asset) { // We don't want to apply this CSS everywhere if (UseMarginCssClass) { CssClass += " ImgThbMrg"; } if (!String.IsNullOrEmpty(OtherCssClass)) { CssClass += " " + OtherCssClass; } bool highlighted = false; if (HighlightIfRestricted) { if (!asset.IsPublishedAndAvailable()) { highlighted = true; BorderWidth = new Unit("3px"); BorderColor = Color.DarkGray; } else if (EntitySecurityManager.IsAssetRestricted(SessionInfo.Current.User, asset)) { highlighted = true; BorderWidth = new Unit("1px"); CssClass += " ImgThbOutline0"; } } if (highlighted) { if (BorderWidth.IsEmpty) { BorderWidth = new Unit("2px"); } } else { BorderWidth = new Unit("1px"); CssClass += " ImgThbOutline1"; } // Strip double spaces CssClass = CssClass.Replace(" ", " "); // Trim additional whitespace CssClass = CssClass.Trim(); }