问题描述
我用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 (将#修改为@)