ajax - ASP.NET : ImageButton Image Doesn't Update inside UpdatePanel -


i have imagebutton inside updatepanal, onclick event, process preformed on same image. image save on same location.

problem is, code behind executes successfully, result doesn't show on webpage

asp code:

<asp:scriptmanager id="scriptmanager1" runat="server" />     <asp:updatepanel id="updatepanel1" childrenastriggers="true" updatemode="always" runat="server">         <contenttemplate>               <asp:imagebutton  id="imagebutton1" runat="server" autopostback="true" imageurl="~/sel_img/test.jpg" onclick="imagebutton1_click" />         </contenttemplate>         <triggers>             <asp:asyncpostbacktrigger controlid="imagebutton1" />         </triggers>     </asp:updatepanel> 

code behind

protected void imagebutton1_click(object sender, imageclickeventargs e) {    using (bitmap bitmap = new bitmap((server.mappath(@"/sel_img/test.jpg")))    bitmap bmp = some_process(bitmap);    bitmap.dispose();    bmp.save(server.mappath(@"/sel_img/test.jpg"));    imagebutton1.imageurl = "../sel_img/test.jpg"; } 

when reload page manually, results shown expected, onclick event results not appear , i.e changes in image doesn't appear.

the change doesn't appear because image in browser cache. force refresh, can append url different query string every time image modified:

protected void imagebutton1_click(object sender, imageclickeventargs e) {     ...     imagebutton1.imageurl = "~/sel_img/test.jpg?" + datetime.now.ticks.tostring(); } 

Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -