在asp.net中的文件上传过程中显示进度消息

问题描述

我用C#Webform创建了一个网页。在服务器处理过程中,它使用UpdateProgress控件显示“正在上传文件...”消息。为了使fileupload控件起作用,我需要将按钮控件放在PostBackTrigger中。但是,这样做时,UpdateProgress不再起作用。如果我从PostBackTrigger中删除按钮控件,则UpdateProgress可以工作,但fileupload控件则不能。有解决办法吗?

        <asp:ScriptManager runat="server" ID="sm1"></asp:ScriptManager>
        <asp:UpdateProgress runat="server" ID="PageUpdateProgress">
            <ProgressTemplate>
                Uploading file...
            </ProgressTemplate>
        </asp:UpdateProgress>
        <asp:UpdatePanel runat="server" ID="Panel">
            <!-- Remove the trigger to make the update panel work,but file upload won't work -->
            <Triggers>
                <asp:PostBackTrigger ControlID="btnFileUpload" />
            </Triggers>
            <ContentTemplate>
                <asp:FileUpload runat="server" ID="FileUpload1" /><br /><br />
                <asp:Button runat="server" ID="btnFileUpload" Text="Upload File" OnClick="x_Click" /><br /><br />
                <asp:Label runat="server" ID="label1"></asp:Label>
            </ContentTemplate>
        </asp:UpdatePanel>
        protected void x_Click(object sender,EventArgs e)
        {
            Thread.Sleep(3000);
            if (FileUpload1.HasFile)
            {
                label1.Text = "HasFile is true";
            }
            else
            {
                label1.Text = "HasFile is false";
            }
        }

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...