HtmlImage control in Cached UserControl loses SRC attribute on subsequent requests
Hi
I created a UserControl that adds a HtmlImage control to it's control collection. I set it's SRC attribute and set the Cache for the macro to be 900 seconds ('Cache By Page' and 'Cache Personalized' are both off).
On first request (e.g. when the control is first created), the SRC attribute is present. However on subsequent requests (e.g. when the control is coming from the cache), the SRC attribute is missing. Other attributes (e.g. TITLE) do exist.
Thye code is below - as anyone come across this before? Using Umbraco 4.2.1, ASP.NET 3.5 SP1, IIS 7 on Windows 2008 Standard. Using ?umbdebugshowtrace=true all looks fine.
Regards
Lee
The .ASCX file is:
<%@ Control Language="C#" AutoEventWireup="false" CodeFile="ImgSrcTest.ascx.cs" Inherits="ImgSrcTest" %>
The .ASCX.CS file is:
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls;
public partial class ImgSrcTest : System.Web.UI.UserControl {
protected override void OnLoad(EventArgs e) { base.OnLoad(e); var img = new HtmlImage(); var imgAttributes = img.Attributes; imgAttributes.Add("title", "I'm here!"); imgAttributes.Add("src", "myimage.png"); this.Controls.Add(img); } }
HtmlImage control in Cached UserControl loses SRC attribute on subsequent requests
Hi
I created a UserControl that adds a HtmlImage control to it's control collection. I set it's SRC attribute and set the Cache for the macro to be 900 seconds ('Cache By Page' and 'Cache Personalized' are both off).
On first request (e.g. when the control is first created), the SRC attribute is present. However on subsequent requests (e.g. when the control is coming from the cache), the SRC attribute is missing. Other attributes (e.g. TITLE) do exist.
Thye code is below - as anyone come across this before? Using Umbraco 4.2.1, ASP.NET 3.5 SP1, IIS 7 on Windows 2008 Standard. Using ?umbdebugshowtrace=true all looks fine.
Regards
Lee
The .ASCX file is:
The .ASCX.CS file is:
And the macro embedded into a template:
is working on a reply...