图片里面的UpdatePanel不工作在Firefox里面、工作、图片、UpdatePanel

2023-09-10 20:17:25 作者:滴了颗星星

我有一个内部的一个Ajax的UpdatePanel自动生成的图像。此图片是从服务器端code生成的图表。搜索在谷歌,我意识到这是FF的错误。任何人都不会有什么解决办法?

下面是源(它也包含不需要的标签,我只是复制粘贴)

 < D​​IV>
   < ASP:UpdatePanel的ID =UpdatePanelGraph=服务器的UpdateMode =条件>
       <的ContentTemplate>
           < ASP:面板ID =pnlGraph=服务器的CssClass =容器>
                < D​​IV ID =图表>
                     <网址:ChartControl ID =chartExchange=服务器WIDTH =300px的高度=200px的边框=无网格=两个DefaultImageUrl =../图像/ noData.pngShowTitlesOnBackground =假边框宽度=1像素填充=1HasChartLegend =假BottomChartPadding =20TopChartPadding =10RightChartPadding =10LeftChartPadding =20>
                            <边框颜色=211,224,242>< /边框>
                            < YAxisFont前景色=115,138,156字体=宋体,7PT的StringFormat =截至目前,中心,字符,LineLimit>< / YAxisFont>
                            < XTitle前景色=115,138,156的StringFormat =中心附近,性格,LineLimit>
                            < / XTitle>
                            < XAxisFont前景色=115,138,156的StringFormat =近,近,性格,NoClip>< / XAxisFont>
                            <背景类型=的LinearGradient颜色=#C9DEFD前景色=透明的EndPoint =500,500>
                            < /背景>
                            < ChartTitle前景色=51,51,51字体=宋体,宋体,风格=大胆的StringFormat =近,近,性格,LineLimit>
                            < / ChartTitle>
                            <图表>
                                <网址:SmoothLineChart名称=买入传奇=BLEN>
                                    <线颜色=ActiveCaption>< /线路>
                                    < D​​ataLabels>
                                        <边框颜色=透明>< /边框>
                                        <背景颜色=透明>< /背景>
                                    < / DataLabels>
                                < /网址:SmoothLineChart>
                                <网址:ColumnChart中名称=avgChart>
                                < /网址:ColumnChart中>
                            < /图表>
                            < YTitle前景色=115,138,156的StringFormat =中心附近,字,LineLimit>< / YTitle>
                    < /网址:ChartControl>
                < / DIV>
            < / ASP:面板>
        < /的ContentTemplate>
    < / ASP:UpdatePanel的>
< / DIV>
 

解决方案

此外,它是不是一个很好的解决方案,设置缓存能力为nocache解决了我的问题。我又写道这对我的页面加载

  Response.Cache.SetCacheability(HttpCacheability.NoCache);
 
为什么选择Firefox而不是Chrome Edge

它也可以通过设置此code

 <脚本类型=文/ JavaScript的>

      变种PRM = Sys.WebForms.PageRequestManager.getInstance();
      prm.add_pageLoaded(为pageLoaded);
      变种C = 0;
      功能为pageLoaded(发件人,参数)
      {
      VAR IMG =的document.getElementById(ctl00_ctl00_MainContent_MainContent_chartExchange);
      C ++;
      img.src = img.src +? + C;
      }

< / SCRIPT>
 

I have an image that is generated automatically inside an Ajax UpdatePanel. This image is a graph that is generated from server-side code. Searching in Google, I realised it was a bug of FF. Does anybody have any solution?

Here is the source (it contains also unneeded tags, I just copied-paste)

<div>
   <asp:UpdatePanel ID="UpdatePanelGraph" runat="server" UpdateMode="Conditional">
       <ContentTemplate>
           <asp:Panel ID="pnlGraph" runat="server" CssClass="container">
                <div id="chart">
                     <Web:ChartControl ID="chartExchange" runat="server" Width="300px" Height="200px" BorderStyle="None" GridLines="both" DefaultImageUrl="../images/noData.png" ShowTitlesOnBackground="False" BorderWidth="1px" Padding="1" HasChartLegend="False" BottomChartPadding="20" TopChartPadding="5" RightChartPadding="5" LeftChartPadding="20">
                            <Border Color="211, 224, 242"></Border>
                            <YAxisFont ForeColor="115, 138, 156" Font="Tahoma, 7pt" StringFormat="Far,Center,Character,LineLimit"></YAxisFont>
                            <XTitle ForeColor="115, 138, 156" StringFormat="Center,Near,Character,LineLimit">
                            </XTitle>
                            <XAxisFont ForeColor="115, 138, 156" StringFormat="Near,Near,Character,NoClip"></XAxisFont>
                            <Background Type="LinearGradient" Color="#C9DEFD" ForeColor="Transparent" EndPoint="500, 500">
                            </Background>
                            <ChartTitle ForeColor="51, 51, 51" Font="Verdana, 9pt, style=Bold" StringFormat="Near,Near,Character,LineLimit">
                            </ChartTitle>
                            <Charts>
                                <Web:SmoothLineChart Name="buy" Legend="Blen">
                                    <Line Color="ActiveCaption"></Line>
                                    <DataLabels>
                                        <Border Color="Transparent"></Border>
                                        <Background Color="Transparent"></Background>
                                    </DataLabels>
                                </Web:SmoothLineChart>
                                <Web:ColumnChart Name="avgChart">
                                </Web:ColumnChart>
                            </Charts>
                            <YTitle ForeColor="115, 138, 156" StringFormat="Center,Near,Word,LineLimit"></YTitle>
                    </Web:ChartControl>
                </div>                
            </asp:Panel>
        </ContentTemplate>
    </asp:UpdatePanel>
</div>

解决方案

Also it is not a good solution, setting the cacheability to nocache resolved my problem. I worte this on my pageload

  Response.Cache.SetCacheability(HttpCacheability.NoCache);

It also works by setting this code

<script type="text/javascript">

      var prm = Sys.WebForms.PageRequestManager.getInstance();
      prm.add_pageLoaded(pageLoaded);
      var c = 0;
      function pageLoaded(sender, args)
      {
      var img = document.getElementById("ctl00_ctl00_MainContent_MainContent_chartExchange");
      c++;
      img.src = img.src + "?" + c;
      }

</script>

 
精彩推荐