Image control does not refresh

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Sunit Joshi

    #1

    Image control does not refresh

    Hello All

    I have an image control in main.aspx in a method

    BuildImage()
    {
    //...code..
    imgDisks.ImageU rl = "barChart.aspx" ;

    }

    This is called whenever the user Clicks on Submit button:

    In barChart.aspx I do:
    private void Page_Load(objec t sender, System.EventArg s e)
    {
    Chart chart = getChart();
    Bitmap bitmap = new Bitmap(chart.Wi dth, chart.Height,
    PixelFormat.For mat32bppArgb);
    Graphics g = Graphics.FromIm age(bitmap);
    chart.draw(g);

    MemoryStream stream = new MemoryStream();
    bitmap.Save(str eam, ImageFormat.Png );

    Response.Clear( );
    Response.Conten tType = "image/png";
    Response.Binary Write(stream.To Array());
    g.Dispose();
    }

    However I still have to sometimes click on submit twice to get the new
    image. Any pointers on what might be happening are greatly
    appreciated.

    thanks
    Sunit
    sjoshi@ingr.com
  • Suresh

    #2
    Image control does not refresh

    It's possible that your page is being loaded from the
    cache on the browser.
    Try adding junk(random) to the URL and see if that helps.
    (i.e. mypage.asps?jun k=1340891234809 )

    HTH,
    Suresh.
    [color=blue]
    >-----Original Message-----
    >Hello All
    >
    >I have an image control in main.aspx in a method
    >
    >BuildImage()
    >{
    >//...code..
    >imgDisks.Image Url = "barChart.aspx" ;
    >
    >}
    >
    >This is called whenever the user Clicks on Submit button:
    >
    >In barChart.aspx I do:
    >private void Page_Load(objec t sender, System.EventArg s e)
    >{
    > Chart chart = getChart();
    > Bitmap bitmap = new Bitmap(chart.Wi dth,[/color]
    chart.Height,[color=blue]
    >[/color]
    PixelFormat.For mat32bppArgb);[color=blue]
    > Graphics g = Graphics.FromIm age(bitmap);
    > chart.draw(g);
    >
    > MemoryStream stream = new MemoryStream();
    > bitmap.Save(str eam, ImageFormat.Png );
    >
    > Response.Clear( );
    > Response.Conten tType = "image/png";
    > Response.Binary Write(stream.To Array());
    > g.Dispose();
    >}
    >
    >However I still have to sometimes click on submit twice[/color]
    to get the new[color=blue]
    >image. Any pointers on what might be happening are greatly
    >appreciated.
    >
    >thanks
    >Sunit
    >sjoshi@ingr.co m
    >.
    >[/color]

    Comment

    Working...