Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

RE: Image.DataBind in UpdatePanel not working in IE9, but works in Chrome

$
0
0

I have a page that is creating an image with the current time, and uses an UpdatePanel to refresh the image every second.  It works fine in Chrome, but when I look at it in Internet Explorer, it's static, it does not refresh.  If I refresh the page, it refreshes with the current time, but still does not update automatically.

I also have a Label control doing the same thing, getting the current date and time.  In both IE and Chrome it refreshes every second, so I know my UpdatePanel is working correctly.  Seems like there might be an issue with doing a DataBind() on an Image in IE?

<form id="form1" runat="server"><div><asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager><asp:UpdatePanel ID="upTimeImage" runat="server" UpdateMode="conditional" ChildrenAsTriggers="true"><ContentTemplate><asp:Timer ID="tTimeImage" runat="server" Interval="1000" OnTick="tTimeImage_Tick"></asp:Timer><asp:Image ID="imgTimeImage" runat="server" ImageUrl="~/TimeImage.aspx"/><br /><asp:Label runat="server" Text="" ID="lblTime"></asp:Label></ContentTemplate><Triggers><asp:AsyncPostBackTrigger ControlID="tTimeImage" /></Triggers></asp:UpdatePanel></div></form>

 

    protected void tTimeImage_Tick(object sender, EventArgs e)
    {
        imgTimeImage.DataBind();

        string currentTime = DateTime.Now.ToString();
        lblTime.Text = currentTime;
    }



 

 

Image:

        string currentTime = DateTime.Now.ToString();

        Bitmap oCanvas;
        oCanvas = new Bitmap(250, 50);

        Graphics g = Graphics.FromImage(oCanvas);
        g.Clear(Color.White);

        FontFamily fontfml = new FontFamily(GenericFontFamilies.Serif);
        Font font = new Font(fontfml, 15);
        SolidBrush brush = new SolidBrush(Color.Black);
        g.DrawString(currentTime, font, brush, 15, 15);

        // Now, we only need to send it to the client
        Response.ContentType = "image/jpeg";
        oCanvas.Save(Response.OutputStream, ImageFormat.Jpeg);
        Response.End();

        // Cleanup
        g.Dispose();
        oCanvas.Dispose();





Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>