Modalpopupextender with UpdateProgress wont work?

peter liles 556 Reputation points
2022-09-06T13:55:11.727+00:00

I have introduced AJAX UpdateProgress control with Modal. Inside Modal is multiple Fileupload controls. When i attempt to save files the FileUpload controls are reset to empty? I have tried various means like placing UpdatePanel outside Modal without success. It just doesnt like updateprogress control?

<asp:updateprogress associatedupdatepanelid="UpdatePanel1"
id="updateProgress" runat="server" >
<progresstemplate>

    <div id="processMessage"> Loading...  

    </div>  
</progresstemplate>  
     </asp:updateprogress>  

<div class="Modalform" style="display:none;" id="mySidebar">

<button id="closeBtn" class="w3-button w3-large" >Close</button>

<asp:UpdatePanel ID="UpdatePanel1" runat="server" >
<ContentTemplate>

<asp:FileUpload ID="FileUpload1" runat="server" CssClass="w3-bar-item"        />  
 * <asp:TextBox ID="TextBox1" runat="server"  MaxLength="200"  Width="400" ></asp:TextBox>  

<asp:FileUpload ID="FileUpload2" runat="server" CssClass="w3-bar-item" />
* <asp:TextBox ID="TextBox2" MaxLength="200" runat="server" Width="400"></asp:TextBox>
<asp:FileUpload ID="FileUpload3" runat="server" CssClass="w3-bar-item" />
* <asp:TextBox ID="TextBox3" runat="server" MaxLength="200" Width="400"></asp:TextBox>

<asp:Button ID="BUploadtnMultipleFiles" Text="Upload" runat="server" OnClick ="UploadMultipleFiles" /></p>

</ContentTemplate>

</asp:UpdatePanel>

</div>

 <asp:HiddenField ID="HiddenFieldBtnOpen" runat="server" />  
   <ajaxToolkit:ModalPopupExtender ID="ModalPopupExtenderDiscount" runat="server"     
                                 BackgroundCssClass="backgroundColor" BehaviorID="mpeD" DropShadow="true"   
                                 CancelControlID="closeBtn"  PopupControlID="mySidebar"    
                                 TargetControlID="HiddenFieldBtnOpen"  />   
ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,236 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. XuDong Peng-MSFT 10,096 Reputation points Microsoft Vendor
    2022-09-07T11:46:42.267+00:00

    Hi @peter liles ,

    When i attempt to save files the FileUpload controls are reset to empty? I have tried various means like placing UpdatePanel outside Modal without success. It just doesnt like updateprogress control?

    First, a full postback is required when you submit the form to upload the file, so the situation you mentioned is normal (fileupload controls are reset to empty), in fact the file has been correctly uploaded to the path you specified. Or is there something wrong with the upload code?

    Second, if you need to display the updateprogress based on the state of the UpdatePanel, then you need to use asyn postback trigger, the full postback won't work with it.

    To sum up, there is a contradiction between your requirements, so I am afraid you cannot achieve this. I also created simple examples to reproduce your problem and tested them separately. Something like this, you could also test these code and you will find it:

    <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">  
                    <ContentTemplate>  
                        ......  
                    </ContentTemplate>  
                    <Triggers>  
                        <asp:PostBackTrigger ControlID="UploadButton" />  
                        <%--<asp:AsyncPostBackTrigger ControlID="UploadButton" EventName="Click" />--%>  
                    </Triggers>  
     </asp:UpdatePanel>  
    

    Best regards,
    Xudong Peng


    If the answer is the right solution, please click "Accept Answer" and kindly upvote. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments