Hi,
I hope i'm in correct subforum, i can't find one for progressarea and manager.
I've an issue with the ProgressArea control, as first i will describe the scenario:
At page default.aspx we have toolbar and grid. The grid displays list with all XML files available from a folder. After choosing a XML file, RadWindow will be displayed. In this window we will read the XML and process all contents into database. This take some time to complete, so we will display progressarea control to show the status to user. This works very well at first time but after second or third or fourth time the progressarea will not shown.
The progressarea showns with postback only, so we're forcing a postback when the window loads first time.
The code below is a stripped version. The progress will take more than 1 minute. The progress will reach 100 percent.
RadWindow:
Codebehing RadWindow:
I hope i'm in correct subforum, i can't find one for progressarea and manager.
I've an issue with the ProgressArea control, as first i will describe the scenario:
At page default.aspx we have toolbar and grid. The grid displays list with all XML files available from a folder. After choosing a XML file, RadWindow will be displayed. In this window we will read the XML and process all contents into database. This take some time to complete, so we will display progressarea control to show the status to user. This works very well at first time but after second or third or fourth time the progressarea will not shown.
The progressarea showns with postback only, so we're forcing a postback when the window loads first time.
The code below is a stripped version. The progress will take more than 1 minute. The progress will reach 100 percent.
RadWindow:
<html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title></title> <script language="javascript" type="text/javascript"> function StartSync(sender, args) { sender.click(); } </script></head><body> <form id="frm" runat="server"> <div style="display: none"> <telerik:RadButton ID="cmdSync" runat="server" OnClientLoad="StartSync" /> </div> <div style="padding-top: 10px;"> <telerik:RadScriptManager id="ScriptManager1" runat="server" /> <telerik:RadProgressManager id="radProcessMan" runat="server" /> <telerik:RadProgressArea id="radProcessArea" runat="server" Width="375px" SkinID="radProcArea"> <Localization CurrentFileName="Koppelen:" UploadedFiles="Status:" /> <ProgressTemplate> <ul class="ruProgress" style="background-image: none; padding-top: 10px;"> <li class="ruFileCount"> <div id="SecondaryProgressBarOuterDiv" class="ruBar" runat="server"> <div id="SecondaryProgressBarInnerDiv" runat="server"> <!-- --> </div> </div> Status: <span id="SecondaryPercent" runat="server"></span>% (<span id="SecondaryValue" runat="server"></span>) </li> <li class="ruCurrentFile" style="font-size: 12px;"> Bestand: <br /> <div style="height: 30px; overflow: hidden;"> <b><span id="CurrentOperation" runat="server" style="font-size: 12px"></span></b> </div> </li> </ul> </ProgressTemplate> </telerik:RadProgressArea> </div> </form></body></html>Codebehing RadWindow:
Imports Telerik.Web.UIPartial Class frmSync Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not Page.IsPostBack Then radProcessArea.ProgressIndicators = Upload.ProgressIndicators.CurrentFileName Or _ Upload.ProgressIndicators.FilesCount Or _ Upload.ProgressIndicators.FilesCountBar Or _ Upload.ProgressIndicators.FilesCountPercent End If End Sub Protected Sub cmdSync_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdSync.Click doSync() ClientScript.RegisterClientScriptBlock(GetType(Page), "CloseWindow", "GetRadWindow().close()", True) End Sub Private Sub doSync() Dim counter As Integer Dim i As Integer Dim strFileName As String 'set progress to zero UpdateProgress(0, "adressen verwerken...", 0, 0) Try strFileName = "c:\temp\xmlfile.xml" If File.Exists(strFileName) Then xmldoc = New XmlDocument xmldoc.Load(strFileName) counter = xmldoc.SelectNodes("/nodes").Count i = 0 Dim xmlNode As XmlNode For Each xmlNode In xmldoc.SelectNodes("/nodes") 'Process each node 'update progressbar UpdateProgress(CInt(i / (counter / 100)), "", counter, i) i += 1 Next End If Catch ex As Exception exceptions.log.Publish(ex) Finally xmldoc = Nothing End Try End Sub Private Sub UpdateProgress(ByVal intPercent As Integer, ByVal strMessage As String, ByVal intCount As Integer, ByVal intCurrent As Integer) Dim radProgress As RadProgressContext Try radProgress = RadProgressContext.Current radProgress.SecondaryPercent = intPercent radProgress.SecondaryTotal = 100 radProgress.SecondaryValue = String.Format("adres {0} van {1} adressen", intCurrent, intCount) radProgress.CurrentOperationText = strMessage Catch ex As Exception exceptions.log.Publish(ex) End Try End SubEnd Class