I am updating the grid based on the the timer set and the grid is inside an UpdatePanel.
All the values in the grid are updated except the ProgressBar. It still shows the old value.
Please see the following code.
function myOnClientProgressBarUpdating(radProgressArea, args)
{
//The primary progress bar will be horizontal (default)
if (args.get_progressBarElementName() == "PrimaryProgressBar")
{
radProgressArea.updateHorizontalProgressBar(
args.get_progressBarElement(), args.get_progressValue());
//Skip the default progress bar updating
args.set_cancel(
true);
}
}
</
script>
<div>
<asp:Timer ID="Timer1" runat="server" Interval="3000">
</asp:Timer>
</div>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
</Triggers>
<ContentTemplate>
<table>
<tr>
<td align="center">
<asp:Label ID="lblProcessDate" runat="server" Text="Select ProcessDate"></asp:Label>
<telerik:raddatepicker id="rdpProcessDate" runat="server">
</telerik:raddatepicker>
</td>
</tr>
<tr>
<td align="center">
<asp:Button ID="btnGo" runat="server" OnClick="btnGo_Click" Text="Submit" CssClass="btn" />
</td>
</tr>
<tr>
<td>
<telerik:radprogressmanager id="Manger1" runat="server">
</telerik:radprogressmanager>
<telerik:radgrid id="radgProcessorStatus" runat="server" autogeneratecolumns="False"
width="100%" gridlines="None" skin="Office2007" allowpaging="True" datasourceid="ProcessorStatusDS"
ondatabound="radgProcessorStatus_DataBound" onitemdatabound="radgProcessorStatus_ItemDataBound">
<MasterTableView DataSourceID="ProcessorStatusDS">
<RowIndicatorColumn>
<HeaderStyle Width="20px"></HeaderStyle>
</RowIndicatorColumn>
<ExpandCollapseColumn>
<HeaderStyle Width="20px"></HeaderStyle>
</ExpandCollapseColumn>
<Columns>
<telerik:GridBoundColumn HeaderText="ProcessDate" UniqueName="ProcessDate"
DataField="ProcessDate" SortExpression="ProcessDate">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Correspondent" UniqueName="CorrespondentName"
DataField="CorrespondentName" SortExpression="CorrespondentID">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Total" UniqueName="Total"
DataField="Total" SortExpression="Total">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Processed" HeaderText="Current" SortExpression="Processed" UniqueName="Processed">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Start" HeaderText="Start" UniqueName="Start">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="End" HeaderText="End" UniqueName="End">
</telerik:GridBoundColumn>
<telerik:GridTemplateColumn HeaderText="Percentage" UniqueName="TemplateColumn">
<ItemTemplate>
<telerik:RadProgressArea id="Area1" runat="server" Skin="Outlook" InProgress="true" onclientprogressbarupdating="myOnClientProgressBarUpdating" >
<ProgressTemplate>
<ul class="ruProgress" style="padding:1px">
<li class="ruFilePortion" style="margin:0px">
Completed
<span id="PrimaryPercent" runat="server" ></span>%
(
<span id="PrimaryValue" runat="server" ></span> ) Total
<span id="PrimaryTotal" runat="server" ></span>
<div id="PrimaryProgressBarOuterDiv" class="ruBar" runat="server" style="height:10" >
<div id="PrimaryProgressBarInnerDiv" runat="server" style="width:200"><!-- --></div>
</div>
</li>
</ul>
</ProgressTemplate>
</telerik:RadProgressArea>
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
</MasterTableView>
<ClientSettings EnableRowHoverStyle="true">
<Selecting AllowRowSelect="True" />
</ClientSettings>
<FilterMenu EnableTheming="True">
<CollapseAnimation Duration="200" Type="OutQuint" />
</FilterMenu>
</telerik:radgrid>
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
codebehind
protected void LooongMethodWhichUpdatesTheProgressContext(RadProgressArea area,string total,string current)
{
RadProgressContext progress = RadProgressContext.Current;
progress.PrimaryTotal = total.ToString();
progress.PrimaryPercent = current.ToString();
progress.PrimaryValue = current.ToString();
StringWriter writer = new StringWriter();
progress.Serialize(writer);
//mainScript.Append(String.Format("function displayProgressAreas() {{ {1};$find('{0}').update(rawProgressData);}}", area.ClientID, writer.GetStringBuilder().ToString()));
mainScript.Append(
String.Format("{1};$find('{0}').update(rawProgressData);", area.ClientID, writer.GetStringBuilder().ToString()));
}
protected
void radgProcessorStatus_ItemDataBound(object sender, GridItemEventArgs e)
{
RadProgressArea area = (RadProgressArea)(e.Item.FindControl("Area1"));
if (area != null)
LooongMethodWhichUpdatesTheProgressContext(area,e.Item.Cells[4].Text,e.Item.Cells[5].Text);
}
protected void radgProcessorStatus_DataBound(object sender, EventArgs e)
{
mainScript.Append(
"}");
string script = "function displayProgressAreas() {";
string scriptFinal = string.Concat(script, mainScript);
string script1 = "Sys.Application.add_load(function(){ displayProgressAreas();});";
string script2 = string.Empty;
if (!Page.IsPostBack)
script2 =
String.Concat("<script type='text/javascript'> ", scriptFinal, script1, " </script>");
else
{
script2 =
String.Concat("<script type='text/javascript'> ", scriptFinal, script1);
string unloadScript = "Sys.Application.add_unload(function(){ displayProgressAreas();});";
script2 =
String.Concat("<script type='text/javascript'> ", script2, unloadScript, " </script>");
}
ClientScript.RegisterStartupScript(
this.GetType(), "DisplayProgressAreas", script2, false);
}