Reputation: 13308
I have a button and an image in update panel. How do I force the image refresh by clicking on the button?
update
<b>Enter the code</b>
<asp:UpdatePanel runat="server">
<ContentTemplate>
<uc:TextBox ID="txtCaptcha" runat="server" />
<asp:Button ID="btnRefreshCaptcha" runat="server" Text="Refresh the code" CausesValidation="false" onclick="btnRefreshCaptcha_Click" />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnRefreshCaptcha" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
Upvotes: 3
Views: 6865
Reputation: 11
i used the above code but it shows the script problem in dropdown list what i gave it in master page and call them as a class files in every pages.After using the above code in my coding and i refresh the captcha it shows the overload of dropdownlist in my page and refreshment of captcha works only once after tis problem occurs i cant to refresh the captcha image in my page.
Upvotes: 1
Reputation: 900
Add random value parameter to the end of your image url and change that on each update
kind of ImageUrl = baseUrl + "?" + new Random().Next()
Upvotes: 8
Reputation: 12707
Did you try
Sub btnRefresh_Click() Handles btnRefresh.Click
Me.Image.ImageUrl = "path to your image file"
End Sub
Upvotes: 1