Click here to Skip to main content
15,892,575 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi..!

I have two nested updatepanels in my aspx page.

In the child update panel, i have an image control.
I'm using an image button to refresh the image of the image control in the code behind.

But, its not working as i'm expecting. Here is my .aspx page code,

XML
<asp:UpdatePanel ID = "up1" runat = "server" >
   <ContentTemplate>
   <asp:UpdatePanel ID = "xxx" runat = "server" >
   <ContentTemplate>
      <fieldset style="padding:10px;width:30%;">

         <asp:Image ID="ImageCaptcha" ImageUrl="~/captcha.ashx"  
            runat="server" Height="50px" AlternateText="If you can't 
            read this number refresh your screen" Width="124px" /><br />

         <asp:ImageButton ID="btnRefresh" runat="server" 
            Width="20px" TabIndex="17" 
            ImageUrl="~/Images/refreshimg.jpg" Height="16px" 
            ToolTip="Refresh Code" meta:resourcekey="btnRefreshResource1" 
            CausesValidation="true" />
        
         <asp:Button ID="btnSubmit" runat="server" 
            Height="28px" meta:resourcekey="btnSubmitResource1" 
            Text="Create" Width="109px" TabIndex="18" />

      </fieldset>
   </ContentTemplate>
</asp:UpdatePanel>
<pre>&lt;/ContentTemplate&gt;
&lt;/asp:UpdatePanel&gt;



Code Behind is,

VB
Protected Sub btnRefresh_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnRefresh.Click

       ImageCaptcha.ImageUrl = "~/logo.jpg"
   End Sub
Posted
Updated 12-Jan-14 20:29pm
v2

You can use xxx.Update(); to update the panel forcefully, however you have to set UpdateMode = Conditional of the UpdatePanel tag in aspx in order to do that.
 
Share this answer
 
Comments
Tuduru Sai Krishna 13-Jan-14 4:00am    
Thank You Prabhat Kr. Singh..!

Here I Forgot To Mention One Thing.
The url of the imagecontrol is .ashx file.
In fact i'm using a captch image here.
refershing the captcha is not working.

I can give you more info. If you didnt understand the problem..!

Thank You..!
Sorry for the late. I have Solved the issue long back. This is happening because of browser's cache. I have disabled cache and every thing is working fine now. Thanks Every one.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900