Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6067743
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:38:29+00:00 2026-05-23T09:38:29+00:00

I have a GridView in which I have an UpdatePanel . I am trying

  • 0

I have a GridView in which I have an UpdatePanel. I am trying to update the I*mage URL* of my asp:image by using AJAX ASyncFileUpload. I’ve been searching on Google for a solution for the past 2 days now.

Here is the code:

Update panel:

<asp:UpdatePanel ID="pnlInfo" runat="server" Font-Names="Times New Roman" UpdateMode="Always" EnableViewState="true" 
                                style="display:none; background-color:#FFFFFF; padding:20px; margin:50px; border:3px solid #4B0303; color:Black; 
                                width:inherit;" 
                                >
                                <ContentTemplate>
                                <div runat="server" class="divTable" style="width:inherit;">

                                    <div runat="server" class="divRow" style="text-align:center; width:300px; float:left;">
                                        <asp:Image ID="imgUser" runat="server" ImageAlign="Middle" ImageUrl="~/silhouette.jpg"
                                             Width="100px" Height="100px" EnableViewState="true"/>
                                        <asp:ModalPopupExtender ID="ModalPopupEUpload" runat="server" 
                                            CancelControlID="btnClosePnl" OnCancelScript="HideModalPopup()"
                                            TargetControlID="imgUser" PopupControlID="pnlUploadImage" Drag="True" 
                                            BackgroundCssClass="ModalPopupBg" DynamicServicePath="" Enabled="True"  />
                                        <asp:Panel ID="pnlUploadImage" runat="server" Font-Names="Times New Roman" 
                                            style="display:none; background-color:#FFFFFF; padding:20px; 
                                            margin:50px; border:3px solid #4B0303; color:Black; width:inherit;" 
                                            >
                                                <asp:AsyncFileUpload ID="AsyncFileUpload" runat="server" OnUploadedComplete="OnUpdateComplete"/>
                                                <asp:Button ID="btnClosePnl" runat="server" Text="Close"/>
                                                <asp:Button ID="btnUpdate" runat="server" OnClick="OnUpdateComplete" Visible="false"  />
                                        </asp:Panel></div>

//more code
</div>
                                </ContentTemplate>
                                <Triggers>
                                    <asp:AsyncPostBackTrigger ControlID="AsyncFileUpload" EventName="UploadedComplete" />
                                </Triggers>
                            </asp:UpdatePanel></div>

The Update Panel is part of a ModalPopupExtender, so is the pnlUploadImage. These works fine. The GridView works fine too.

Background code:

protected void OnUpdateComplete(object sender, EventArgs e)
        {
            Image ImgUser = new Image();
            AsyncFileUpload asyncSender = new AsyncFileUpload();
            AsyncFileUpload asyncGv = new AsyncFileUpload();

            //finding the row of the sender
            asyncSender = (AsyncFileUpload)sender;

            foreach (GridViewRow Row in gvData.Rows)
            {
                asyncGv = (AsyncFileUpload)Row.Cells[0].FindControl("AsyncFileUpload");
                if (asyncSender.ClientID == asyncGv.ClientID)
                {
                    ImgUser = (Image)Row.Cells[0].FindControl("imgUser");
                    ImgUser.ImageUrl = asyncSender.FileName;
                    break;
                }
            }
        }

The btnUpdate was a possible solution that ended up not working. Basically, when I click on the Image, the AsyncFileUpload pops in a popup format. Then I choose an image and Upload it. I trigger the Update on the UploadComplete which is suppose to change the Image URL.

The problem is that the image that I see (silhouette.jpg) stays there even after going trough UploadComplete. When I do a step by step, I see my that the ImageURL is being changed. I checked and it is the right image that is being selected in the function.

Overall, why does, even thought the ImageURL is being changed in the backcode, the image that I see on my browser does not change.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T09:38:29+00:00Added an answer on May 23, 2026 at 9:38 am

    I had to create an asp:button with a method click that had a javascript postback in it. Then I created a asynchPostBack trigger in teh update panel on the button I just created. It forces a postback but it is the only way to automatically update the picture.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a GridView control which is inside an AJAX update panel by default
I have a gridview within an updatepanel which allows paging and has a linkbutton
I have a asp:GridView which contains a asp:TextBox within a TemplateField. I would like
I have a gridview in an update panel and am using a jQuery dialog
I have a GridView which is continually rebound using a timer and is within
I have several dropdownlists and textboxes inside an <asp:UpdatePanel> , which should let me
I have an UpdatePanel containing a GridView which contains a button in the HeaderTemplate
I have user control on a ASP.NET web page, which contains a GridView and
I have apply paging in GridView which is in UpdatePanel.When I move forward to
I have a GridView which uses BoundField for columns. I am trying to set

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.