我的项目中有一个Telerik进度条:
<telerik:RadProgressManager ID="RadProgressManager" Runat="server" />
<telerik:RadProgressArea ID="RadProgressArea" Runat="server"></telerik:RadProgressArea>
<asp:button id="Button1" runat="server" text="Submit" />
单击按钮,我尝试运行此方法:
private void MethodWhichUpdatesTheProgressContext(UploadedFile file, int countFile)
{
const int total = 100;
RadProgressContext ProgressContex = RadProgressContext.Current;
ProgressContex.SecondaryTotal = "100";
for (int i = 0; i < total; i++)
{
ProgressContex.CurrentOperationText = "Uploading zip file percentage " + i.ToString();
if (!Response.IsClientConnected)
{
break;
}
System.Threading.Thread.Sleep(100);
}
}
项目构建没有任何错误,但进度不会改变。 如何正确触发进度条动画? 如果我把这个进度条置于控制之下,它会影响到这个吗?
答案 0 :(得分:1)
在循环中增加 ProgressContex.SecondaryValue 或 ProgressContex.SecondaryPercent :
for (int i = 0; i < 100; i++)
{
ProgressContex.CurrentOperationText = "Uploading zip file percentage " + i.ToString();
ProgressContex.SecondaryValue = i.ToString();
ProgressContex.SecondaryPercent = i.ToString();
}