How can I make the Telerik progress bar work?
I have a Telerik progress bar in my project:
<telerik:RadProgressManager ID="RadProgressManager" Runat="server" />
<telerik:RadProgressArea ID="RadProgressArea" Runat="server"></telerik:RadProgressArea>
<asp:button id="Button1" runat="server" text="Submit" />
On button click I try to run this method:
private void MethodWhichUpdatesTheProgressContext(UploadedFile file, int countFile)
{
const int total = 100;
RadP开发者_如何学运维rogressContext 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);
}
}
Project builds without any errors but progress doesn't change. How do I properly fire the progress bar animation? If I put this progress bar on control, it can effect this?
Increment the ProgressContex.SecondaryValue or ProgressContex.SecondaryPercent inside the loop:
for (int i = 0; i < 100; i++)
{
ProgressContex.CurrentOperationText = "Uploading zip file percentage " + i.ToString();
ProgressContex.SecondaryValue = i.ToString();
ProgressContex.SecondaryPercent = i.ToString();
}
See Also:
RadProgressArea Custom Progress
精彩评论