为什么不asp:UpdatePanel刷新图像?
我有以下UpdatePanel从ashx处理程序获取图像,所有这些都在页面刷新时正常工作。 但是,当计时器触发时,标签会以当前时间刷新,但不会刷新图像。
计时器例程是:
protected void UpdateTimer_Tick(object sender, EventArgs e) { DateStampLabel.Text = DateTime.Now.ToString(); }
为什么图像没有刷新?
一般来说,AJAX很容易出现浏览器缓存。 我通常会在URL中添加DateTime.Now.Ticks
。 此外,您的UpdateMode是条件,您必须调用Update()
:
protected void UpdateTimer_Tick(object sender, EventArgs e) { DateStampLabel.Text = DateTime.Now.ToString(); Image1.ImageUrl += "&CacheBuster=" + DateTime.Now.Ticks.ToString(); TimedPanel.Update(); }