开发者

Force refresh image in update panel

I ha开发者_运维百科ve 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>


Add random value parameter to the end of your image url and change that on each update

kind of ImageUrl = baseUrl + "?" + new Random().Next()


Did you try

Sub btnRefresh_Click() Handles btnRefresh.Click

    Me.Image.ImageUrl = "path to your image file"

End Sub


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜