I have two WCF service calls:
[OperationContract]
void ClosePeriod();
[OperationContract]
string GetLogs();
ClosePeriod method runs a stored procedure that takes 1 hour, and it generates log messages. GetLogs method returns the log messages generated from ClosePeriod method.
I'm trying to display the log messages on the ASP.Net webpage while waiting on the ClosePeriod service call.
<asp:UpdatePanel ID="UpdatePanelClosing" runat="server">
<ContentTemplate>
<asp:Timer ID ="TimerLog" runat ="server" Interval ="3000" OnTick="TimerLog_Tick" Enabled="true"></asp:Timer>
<table>
<tr>
<td>
<div style="margin-top: 10px; margin-bottom: 70px">
<asp:Button runat="server" ID="BtnExecuteClosing" Text="Execute" Width="105px" Height="35px" OnClick="BtnExecuteClosing_Click" />
</div>
</td>
</tr>
<tr>
<td>
<p>Process Log:</p>
</td>
</tr>
<tr>
<td colspan="3">
<asp:TextBox ID="TxtProcessLog" runat="server" Width="930px" Height="270" TextMode="MultiLine" Style="resize: none;"
ReadOnly="true" Text="">
</asp:TextBox>
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
so far I tried to call ClosePeriod method asynchronously, and I tried to update TxtProcessLog textbox using the timer.
protected async void BtnExecuteClosing_Click(object sender, EventArgs e)
{
await webservice.ClosePeriodAsync();
}
protected void TimerLog_Tick(object sender, EventArgs e)
{
string log = webservice.GetLogs();
TxtProcessLog.Text = log ;
}
But the TxtProcessLog textbox is updated after the ClosePeriod service call is completed. Am I doing something wrong? Please suggest any other approaches.