本文介绍了具有UpdateProgress的FileUpload的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

更新:
我添加了一个Java脚本功能:

UPDATE:
I've added a java script function:

function showWait()
            {
                if ($get('filUpload').value.length > 0)
                {
                    $get('UpdateProgress1').style.display = 'block';
                }
            }


 <asp:Button ID="btnUpload" runat="server" OnClick="btnUpload_Click" OnClientClick="javascript:showWait();" Text="OK" CausesValidation="false" />

但是我需要它在ajax ModalPopupExtender面板中工作,因此当我运行代码时,会出现UpdateProgress,但是动画的gif不会动画!这是静态的!

But I need this to work inside ajax ModalPopupExtender panel, so when i run the code the UpdateProgress appears but the animated gif doesn't get animated! it's static!

<head runat="server">
 <script type="text/javascript">
            function showWait()
            {                       
                $get('UpdateProgress1').style.display = 'block';               
            }



        </script>
    <title>Untitled Page</title>
    <link href="Controls/UploadFile.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
    <div>


    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>    

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
    <asp:Button id="btnShowPopup" runat="server" Text="Open" />
      <asp:Panel ID="pnlUploader" runat="server" CssClass="pnlUploader" Width="280px" style="display:none;" >      


        <div id ="pnlDragMe" class="pnlDragMe">Image Uploader </div>   
        <div id="uploaderContent" class="uploaderContent" runat="server">      
            Select File:
          <br />
          <asp:FileUpload ID="filUpload" runat="server" />
          &nbsp;<br />
          <div id="buttons" >
             <asp:Button ID="btnUpload" runat="server" OnClick="btnUpload_Click" OnClientClick="javascript:showWait();"  Text="OK" CausesValidation="false" />
             <asp:Button ID="btnCancel" runat="server" Text="Cancel" />
          </div> 
        </div>  
        <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
           <ProgressTemplate>
               <img alt="" src="Images/ajax-loader.gif" style="width: 48px; height: 48px" />
               Uploading image...
           </ProgressTemplate>
        </asp:UpdateProgress>      
            <asp:Label ID="lblFeedbackOK" SkinID="FeedbackOK" runat="server"></asp:Label>
            <asp:Label ID="lblFeedbackKO" SkinID="FeedbackKO" runat="server"></asp:Label>              


        <cc1:ModalPopupExtender ID="mdlPopup1" runat="server" 
           TargetControlID="btnShowPopup" PopupControlID="pnlUploader" 
           CancelControlID="btnCancel" BackgroundCssClass="modalBackground" 
           PopupDragHandleControlID="pnlDragMe" Drag="true" RepositionMode="None" />
      </asp:Panel>


    </ContentTemplate>
    <Triggers>
        <asp:PostBackTrigger ControlID="btnUpload" />
    </Triggers>    

</asp:UpdatePanel>

    </form>
</body>

由于PostBackTrigger,我认为动画gif是静态的.

I guess the animated gif is static because of PostBackTrigger.

推荐答案

FileUpload控件在UpdatePanel中不起作用.

The FileUpload control does not work inside a UpdatePanel.

请参见 http://msdn.microsoft.com/en-us/library/cc295545.aspx

这篇关于具有UpdateProgress的FileUpload的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 14:09